sttcl  v0.9c
STTCL C++ template state machine framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SttclBoostSemaphore.h
Go to the documentation of this file.
1 
25 #ifndef STTCLBOOSTSEMAPHORE_H_
26 #define STTCLBOOSTSEMAPHORE_H_
27 
28 #if defined(STTCL_BOOST_THREADS) or defined(STTCL_BOOST_IMPL)
29 #include <boost/interprocess/sync/interprocess_semaphore.hpp>
30 #include "../include/SttclTime.h"
31 
32 namespace sttcl
33 {
34 
35 namespace internal
36 {
37 namespace boost_impl
38 {
42 class SttclBoostSemaphore
43 {
44 public:
45  typedef boost::interprocess::interprocess_semaphore NativeSemaphoreType;
46  SttclBoostSemaphore(unsigned int initialCount);
47  virtual ~SttclBoostSemaphore();
48 
49  void wait();
50  bool try_wait(const TimeDuration<>& timeout);
51  void post();
52 
53 private:
54  NativeSemaphoreType semaphore;
55 };
56 
57 }
58 }
59 }
60 
61 #endif
62 #endif /* STTCLBOOSTSEMAPHORE_H_ */