32#ifndef _QORE_QORECOUNTER_H
34#define _QORE_QORECOUNTER_H
37#include <qore/QoreCondition.h>
38#include <qore/AbstractPrivateData.h>
92 struct qore_counter_private* priv;
101 DLLLOCAL
virtual ~Counter() {
the base class for all data to be used as private data of Qore objects
Definition AbstractPrivateData.h:44
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition ExceptionSink.h:50
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