25 void Reset(
int count);
81 if (LinuxInterlocked::Add(this->
curCount, -num) == num)
101 pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
102 pthread_mutex_lock(&m);
107 pthread_mutex_unlock(&m);
108 pthread_mutex_destroy(&m);
Block a thread until count reaches 0.
Definition linuxcompletioncounter.h:17
void Reset(int count)
reset the counter, call from main thread
Definition linuxcompletioncounter.h:65
void Wait()
wait until counter has reached 0, call from main thread or worker threads
Definition linuxcompletioncounter.h:99
bool Peek()
check if the counter has reached 0
Definition linuxcompletioncounter.h:116
volatile int curCount
Definition linuxcompletioncounter.h:34
~LinuxCompletionCounter()
destructor
Definition linuxcompletioncounter.h:53
bool Decrement(int num)
decrement the counter, call from worker threads, return true if count has reached zero
Definition linuxcompletioncounter.h:79
LinuxCompletionCounter()
constructor
Definition linuxcompletioncounter.h:42
pthread_cond_t completionEvent
Definition linuxcompletioncounter.h:35
#define n_assert(exp)
Definition debug.h:50
Definition linuxcompletioncounter.h:15