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 "dispatch.h"
00031 #include <memory>
00032
00033 __XDISPATCH_BEGIN_NAMESPACE
00034
00043 class XDISPATCH_EXPORT semaphore {
00044
00045 public:
00057 semaphore(int = 1);
00062 semaphore(dispatch_semaphore_t);
00063 semaphore(const semaphore&);
00064 ~semaphore();
00065
00075 int release();
00083 void acquire();
00093 bool try_acquire(dispatch_time_t);
00103 bool try_acquire(struct tm*);
00109 virtual const dispatch_semaphore_t native() const;
00110
00111 private:
00112 class data;
00113 data* d;
00114
00115 };
00116
00117 XDISPATCH_EXPORT std::ostream& operator<<(std::ostream& stream, const semaphore*);
00118 XDISPATCH_EXPORT std::ostream& operator<<(std::ostream& stream, const semaphore&);
00119
00120 __XDISPATCH_END_NAMESPACE
00121
00122 #endif