#include "CallNTimesNoWait.h"
Public Member Functions | |
CallNTimesNoWait (unsigned short iNTimes) | |
template<typename T > | |
void | operator() (T iCall) |
Private Attributes | |
std::atomic< bool > | m_done |
std::atomic< int > | m_ntimes |
Description: Thread safe way to do something N times
Usage: This class allows one to safely do a 'non-side-effect' operation N times in a job. An example use would be
The important thing to remember, is there is no guarantee that the operation being run finishes before a thread which doesn't get to run the operation reaches the code following the call. Therefore it is useful to suppress messages but should not be used to do something like filling a container with values since the filling is not guaranteed to complete before another thread skips the call.
Definition at line 38 of file CallNTimesNoWait.h.
|
inline |
Definition at line 40 of file CallNTimesNoWait.h.
|
inline |
|
private |
Definition at line 55 of file CallNTimesNoWait.h.
Referenced by operator()().
|
private |
Definition at line 54 of file CallNTimesNoWait.h.
Referenced by operator()().