Go to the documentation of this file.00001 #ifndef QRK_SEMAPHORE_H
00002 #define QRK_SEMAPHORE_H
00003
00015 #include <memory>
00016 #include <cstddef>
00017
00018
00019 namespace qrk
00020 {
00022 class Semaphore
00023 {
00024 public:
00030 explicit Semaphore(size_t initial_value);
00031 ~Semaphore(void);
00032
00033
00039 void wait(void);
00040
00041
00050 bool tryWait(void);
00051
00052
00058 void post(void);
00059
00060
00066 size_t value(void);
00067
00068 private:
00069 Semaphore(void);
00070 Semaphore(const Semaphore& rhs);
00071 Semaphore& operator = (const Semaphore& rhs);
00072
00073 struct pImpl;
00074 const std::auto_ptr<pImpl> pimpl;
00075 };
00076 }
00077
00078 #endif