00001 /* 00002 * $Id: Semaphore.h,v 1.2 2003/07/23 21:06:52 mindstorm2600 Exp $ 00003 */ 00004 #ifndef __SEMAPHORE_h__ 00005 #define __SEMAPHORE_h__ 00006 00007 #include<Threading.h> 00008 #ifdef USE_POSIX_THREADS 00009 #include<semaphore.h> 00010 #endif 00011 00012 namespace clawsoft{ 00018 class Semaphore:public Threading{ 00019 private: 00020 #ifdef USE_POSIX_THREADS 00021 sem_t __sem; 00022 #endif 00023 protected: 00024 void init(int x); 00025 void destroy(); 00026 public: 00027 Semaphore(int x); 00028 ~Semaphore(); 00029 void wait(); 00030 void trywait(); 00031 void post(); 00032 void getvalue(int *x); 00033 }; 00034 }; 00035 00036 #endif
Authors:
Juan V. Guerrero
Jannette C. Mejia
Juan C. Guevara
Powered by: