voxelTerrain
 All Classes Functions Variables Typedefs Enumerations Pages
deadlineTimer.hpp
1 #ifndef BLUB_CORE_DEADLINETIMER_HPP
2 #define BLUB_CORE_DEADLINETIMER_HPP
3 
4 #include "blub/async/predecl.hpp"
5 #include "blub/core/globals.hpp"
6 
7 #include <boost/asio/deadline_timer.hpp>
8 
9 
10 namespace blub
11 {
12 namespace async
13 {
14 
15 
17 {
18 public:
19  deadlineTimer(dispatcher& listener);
20 
21  template<typename CompletionHandler>
22  void addToDoOnTimeoutMilli(CompletionHandler handler, const uint32& milli)
23  {
24  m_timer.expires_from_now(boost::posix_time::millisec(milli));
25  m_timer.async_wait(handler);
26  }
27 
28  void cancel()
29  {
30  m_timer.cancel();
31  }
32 
33 protected:
34  dispatcher& m_listener;
35  boost::asio::deadline_timer m_timer;
36 
37 };
38 
39 
40 }
41 }
42 
43 
44 #endif // BLUB_CORE_DEADLINETIMER_HPP
Definition: deadlineTimer.hpp:16
Definition: dispatcher.hpp:29
Definition: deadlineTimer.hpp:10