32 #ifndef _QORE_QORECOUNTER_H
34 #define _QORE_QORECOUNTER_H
37 #include <qore/QoreCondition.h>
43 struct qore_counter_private* priv;
49 DLLLOCAL QoreCounter& operator=(
const QoreCounter&);
53 DLLEXPORT QoreCounter(
int nc = 0);
88 DLLLOCAL
void waitForZero();
DLLEXPORT int getWaiting() const
returns the number of threads blocked on this object
a simple thread-safe counter object; objects can block on it until the counter reaches zero ...
Definition: QoreCounter.h:40
DLLEXPORT void inc()
increments the counter
DLLEXPORT int getCount() const
returns the current count
DLLEXPORT ~QoreCounter()
destroys the object and frees all memory
DLLEXPORT void dec(ExceptionSink *xsink)
decrements the counter and wakes up any threads if the counter reaches 0
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:43
DLLEXPORT void destructor(ExceptionSink *xsink)
throws a Qore-language exception if there are any waiting threads and wakes them all up ...
DLLEXPORT int waitForZero(ExceptionSink *xsink, int timeout_ms=0)
blocks the calling thread until the counter reaches 0