00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef PTLIB_SEMAPHORE_H
00035 #define PTLIB_SEMAPHORE_H
00036
00037 #ifdef P_USE_PRAGMA
00038 #pragma interface
00039 #endif
00040
00041 #include <ptlib/psync.h>
00042 #include <limits.h>
00043 #include <ptlib/critsec.h>
00044
00078 class PSemaphore : public PSync
00079 {
00080 PCLASSINFO(PSemaphore, PSync);
00081
00082 public:
00089 PSemaphore(
00090 unsigned initial,
00091 unsigned maximum
00092 );
00093
00096 PSemaphore(const PSemaphore &);
00097
00101 ~PSemaphore();
00103
00109 virtual void Wait();
00110
00117 virtual PBoolean Wait(
00118 const PTimeInterval & timeout
00119 );
00120
00125 virtual void Signal();
00126
00133 virtual PBoolean WillBlock() const;
00135
00136 private:
00137 PSemaphore & operator=(const PSemaphore &) { return *this; }
00138
00139
00140
00141 #ifdef _WIN32
00142 #include "msos/ptlib/semaphor.h"
00143 #else
00144 #include "unix/ptlib/semaphor.h"
00145 #endif
00146 };
00147
00148
00149 #endif // PTLIB_SEMAPHORE_H
00150
00151
00152