00001 /* 00002 * $Id: ConditionVar.h,v 1.3 2003/07/23 19:47:41 mindstorm2600 Exp $ 00003 */ 00004 #ifndef __SHARED_VAR_h__ 00005 #define __SHARED_VAR_h__ 00006 00007 #include<Threading.h> 00008 #include<Mutex.h> 00009 #ifdef USE_POSIX_THREADS 00010 #include<pthread.h> 00011 #endif 00012 00013 namespace clawsoft{ 00024 class ConditionVar:public Threading{ 00025 private: 00026 protected: 00027 #ifdef USE_POSIX_THREADS 00028 pthread_cond_t __cvar; 00029 #endif 00030 void init(); 00031 void destroy(); 00032 public: 00033 ConditionVar(); 00034 ~ConditionVar(); 00038 void signal(); 00042 void broadcast(); 00046 void wait(Mutex *mutex); 00050 void timedWait(Mutex *mutex, long seconds = 1, long nanoseconds = 0); 00052 static void wait(ConditionVar *cv, Mutex *mutex); 00054 static void timedWait(ConditionVar *cv, Mutex *mutex, long seconds = 1, long nanoseconds = 0); 00055 }; 00056 }; 00057 00058 #endif
Authors:
Juan V. Guerrero
Jannette C. Mejia
Juan C. Guevara
Powered by: