00001 #line 1055 "./lpsrc/flx_pthread.pak"
00002 #ifndef __SEMAPHORE__
00003 #define __SEMAPHORE__
00004 #include <flx_pthread_config.hpp>
00005 #include "pthread_mutex.hpp"
00006
00007 #include "pthread_win_posix_condv_emul.hpp"
00008
00009 namespace flx { namespace pthread {
00010
00011
00012
00013
00014 class PTHREAD_EXTERN flx_semaphore_t {
00015 sem_t sem;
00016 public:
00017 flx_semaphore_t(int n=0);
00018 ~flx_semaphore_t();
00019 void post();
00020 void operator++() { post(); }
00021 void wait();
00022 void operator--() { wait(); }
00023 int get();
00024 int operator*() { return get(); }
00025
00026
00027
00028 int trywait();
00029 };
00030
00031 }}
00032 #endif
00033