voxelTerrain
 All Classes Functions Variables Typedefs Enumerations Pages
strand.hpp
1 #ifndef ASYNC_STRAND_HPP
2 #define ASYNC_STRAND_HPP
3 
4 #include "blub/async/predecl.hpp"
5 #include "blub/core/globals.hpp"
6 
7 #include <boost/asio/strand.hpp>
8 
9 
10 namespace blub
11 {
12 namespace async
13 {
14 
15 
16 class strand
17 {
18 public:
19  strand(dispatcher& disp);
20 
21  template<typename CompletionHandler>
22  void dispatch(CompletionHandler handler)
23  {
24  m_service.dispatch(handler);
25  }
26 
27  template<typename CompletionHandler>
28  void post(CompletionHandler handler)
29  {
30  m_service.post(handler);
31  }
32 
33  bool isRunningInThisThread() const
34  {
35  return m_service.running_in_this_thread();
36  }
37 
38  const dispatcher &getDispatcher() const;
39 
40 private:
41  dispatcher &m_dispatcher;
42 
43  boost::asio::strand m_service;
44 
45 };
46 
47 
48 }
49 }
50 
51 
52 #endif // ASYNC_STRAND_HPP
Definition: strand.hpp:16
Definition: dispatcher.hpp:29
Definition: deadlineTimer.hpp:10