MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / setProgress

Function setProgress

source/MRViewer/MRProgressBar.cpp:422–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420}
421
422bool setProgress( float p )
423{
424 auto& instance = ProgressBarImpl::instance();
425 if ( p == instance.progress_ )
426 return !instance.canceled_; // fast path if the progress value has not changed
427
428 int newPercents = int( p * 100.0f );
429 int percents = instance.percents_;
430 if ( percents != newPercents && instance.percents_.compare_exchange_strong( percents, newPercents ) )
431 {
432 std::unique_lock lock( instance.mutex_ );
433 spdlog::info( "Operation progress: \"{}\" - {}%", instance.title_, newPercents );
434 }
435
436 assert( p >= instance.progress_ ); // the progress must not jump backward
437 assert( p <= 1 ); // the progress must not exceed 100%
438 instance.progress_ = p;
439 instance.frameRequest_.requestFrame();
440 return !instance.canceled_;
441}
442
443void setTaskCount( int n )
444{

Callers 3

callBackSetProgressFunction · 0.85
operator()Method · 0.85

Calls 2

instanceFunction · 0.85
requestFrameMethod · 0.80

Tested by

no test coverage detected