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