MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::ParallelProgressReporter Class Reference

#include <MRParallelProgressReporter.h>

Classes

struct  PerTaskReporter
 
struct  TaskInfo
 

Public Member Functions

MRMESH_API ParallelProgressReporter (const ProgressCallback &cb)
 
MRMESH_API PerTaskReporter newTask (float weight=1.f)
 
MRMESH_API bool operator() ()
 

Detailed Description

This class allows progress to be reported from different threads. Unlike progress callback that is passed to ParallelFor, each task may report the progress separately, and the progress displayed to user is not just a number of completed tasks divided by the total number of tasks, but rather a (weighted) average of progresses reported from each task

Constructor & Destructor Documentation

◆ ParallelProgressReporter()

MRMESH_API MR::ParallelProgressReporter::ParallelProgressReporter ( const ProgressCallback & cb)

Member Function Documentation

◆ newTask()

MRMESH_API PerTaskReporter MR::ParallelProgressReporter::newTask ( float weight = 1.f)

Add task to the pull

Note
This function must not be invoked concurrently.
Returns
The reporter functor, that could be safely invoked from a different thread

◆ operator()()

MRMESH_API bool MR::ParallelProgressReporter::operator() ( )

Actually report the progress. Designed to be invoked in loop until all tasks are completed or until the operation is cancelled

Note
This function is automatically invoked from the PerTaskReporter::operator() under the condition that the thread that invokes it is the same as the thread from which ParallelProgressReporter was created.

The documentation for this class was generated from the following file: