32#ifndef _QORE_QORECOUNTER_H
34#define _QORE_QORECOUNTER_H
37#include <qore/QoreCondition.h>
38#include <qore/AbstractPrivateData.h>
92 hashdecl qore_counter_private* priv;
the base class for all data to be used as private data of Qore objects
Definition: AbstractPrivateData.h:44
This is the implementation of the "Counter" Qore class (private data)
Definition: QoreCounter.h:99
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:41
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