00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _QORE_QORECONDITION_H
00024
00025 #define _QORE_QORECONDITION_H
00026
00027 #include <pthread.h>
00028 #include <sys/time.h>
00029
00030 #include <qore/QoreThreadLock.h>
00031
00033
00036 class QoreCondition
00037 {
00038 private:
00040 pthread_cond_t c;
00041
00043 DLLLOCAL QoreCondition(const QoreCondition&);
00044
00046 DLLLOCAL QoreCondition& operator=(const QoreCondition&);
00047
00048 public:
00050 DLLEXPORT QoreCondition();
00051
00053 DLLEXPORT ~QoreCondition();
00054
00056 DLLEXPORT int signal();
00057
00059 DLLEXPORT int broadcast();
00060
00062
00066 DLLEXPORT int wait(pthread_mutex_t *m);
00067
00069
00074 DLLEXPORT int wait(pthread_mutex_t *m, int timeout_ms);
00075
00077
00081 DLLEXPORT int wait(QoreThreadLock *l) { return wait(&l->ptm_lock); }
00082
00084
00089 DLLEXPORT int wait(QoreThreadLock *l, int timeout) { return wait(&l->ptm_lock, timeout); }
00090
00092
00096 DLLEXPORT int wait(QoreThreadLock &l) { return wait(&l.ptm_lock); }
00097
00099
00104 DLLEXPORT int wait(QoreThreadLock &l, int timeout) { return wait(&l.ptm_lock, timeout); }
00105 };
00106
00107 #endif // QORE_CONDITION