00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _QORE_QORECOUNTER_H
00025
00026 #define _QORE_QORECOUNTER_H
00027
00028 #include <qore/Qore.h>
00029 #include <qore/QoreCondition.h>
00030
00032 class QoreCounter
00033 {
00034 private:
00036 struct qore_counter_private *priv;
00037
00039 DLLLOCAL QoreCounter(const QoreCounter&);
00040
00042 DLLLOCAL QoreCounter& operator=(const QoreCounter&);
00043
00044 public:
00046 DLLEXPORT QoreCounter(int nc = 0);
00047
00049 DLLEXPORT ~QoreCounter();
00050
00052 DLLEXPORT void destructor(class ExceptionSink *xsink);
00053
00055 DLLEXPORT void inc();
00056
00058
00062 DLLEXPORT void dec(class ExceptionSink *xsink);
00063
00065
00071 DLLEXPORT int waitForZero(class ExceptionSink *xsink, int timeout_ms = 0);
00072
00074 DLLEXPORT int getCount() const;
00075
00077 DLLEXPORT int getWaiting() const;
00078
00079
00080 DLLLOCAL void waitForZero();
00081 DLLLOCAL void dec();
00082 };
00083
00084 #endif