EEROS  1.0.0.0
API for the EEROS Real-Time Robotics Framework
Semaphore.hpp
Go to the documentation of this file.
1 #ifndef ORG_EEROS_CORE_SEMAPHORE_HPP_
2 #define ORG_EEROS_CORE_SEMAPHORE_HPP_
3 
4 #include <mutex>
5 #include <chrono>
6 #include <condition_variable>
7 
8 namespace eeros {
9 
10  class Semaphore
11  {
12  public:
13  Semaphore(int value = 0);
14  void wait();
15  bool wait(double timeout_sec);
16  void post();
17  private:
18  std::mutex mutex;
19  std::condition_variable condvar;
20  int counter;
21  };
22 
23 };
24 
25 #endif /* ORG_EEROS_CORE_SEMAPHORE_HPP_ */
void wait()
Definition: Semaphore.cpp:9
Definition: Semaphore.hpp:10
Semaphore(int value=0)
Definition: Semaphore.cpp:6
Definition: Config.hpp:14
void post()
Definition: Semaphore.cpp:23