This class provides a threadsafe version of OEDots. Multiple threads can call OEThreadedDots::Update to update the progress in an efficient manner in a thread-safe way. This class will create an internal operating system thread to handle output to OEPlatform::oeerr. The complete progress is not guaranteed to be output to the terminal until OEThreadedDots::Total is called.
OEThreadedDots(unsigned int bigstep, unsigned int smallstep, const char *objectname="")
Controls how the following output gets updated:
.......... 10000 things processed. .......... 20000 things processed. .......... 30000 things processed. .......... 40000 things processed. .......... 50000 things processed. .......... 60000 things processed. .......... 70000 things processed. .......... 80000 things processed.
The number of elements before a new line is generated. The above example is a bigstep of 10000.
The number of elements before a single new dot, ., is printed. The above example is a smallstep of 1000. Or 10 dots per line.
A description of what is being processed. In the above example, this is “things”.
Prints a final summary line like the following:
Total: 80000 things processed.
Calling this method waits for all information to flush to the IO thread and then terminates and joins that thread. So this function is effectively a blocking call on those operations. But the operations are typically very cheap, so the blocking nature is not noticeable.
void Update(unsigned int step=1)
Update the progress with the number of elements specified by step. The default is 1 element, but any number can be specified. However, 0 is not a valid step size and will throw an error.
For OEThreadedDots, this method is thread-safe to call from multiple threads even though it is a non-const method.