Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef XDISPATCH_SEMAPHORE_H_
00024 #define XDISPATCH_SEMAPHORE_H_
00025
00026 #ifndef __XDISPATCH_INDIRECT__
00027 #error "Please #include <xdispatch/dispatch.h> instead of this file directly."
00028 #endif
00029
00030 #include <memory>
00031
00032 __XDISPATCH_BEGIN_NAMESPACE
00033
00042 class XDISPATCH_EXPORT semaphore {
00043
00044 public:
00056 semaphore(int = 1);
00061 semaphore(dispatch_semaphore_t);
00062 semaphore(const semaphore&);
00063 ~semaphore();
00064
00074 int release();
00082 void acquire();
00092 bool try_acquire(dispatch_time_t);
00102 bool try_acquire(struct tm*);
00108 virtual const dispatch_semaphore_t native() const;
00109
00110 private:
00111 class data;
00112 data* d;
00113
00114 };
00115
00116 XDISPATCH_EXPORT std::ostream& operator<<(std::ostream& stream, const semaphore*);
00117 XDISPATCH_EXPORT std::ostream& operator<<(std::ostream& stream, const semaphore&);
00118
00119 __XDISPATCH_END_NAMESPACE
00120
00121 #endif