Realistic 3D camera system
3D camera system components
io_service_pool.hpp
Go to the documentation of this file.
1 //
2 // io_service_pool.hpp
3 // ~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10 
11 #ifndef HTTP_SERVER2_IO_SERVICE_POOL_HPP
12 #define HTTP_SERVER2_IO_SERVICE_POOL_HPP
13 
14 #include <asio.hpp>
15 #include <vector>
16 #include <boost/noncopyable.hpp>
17 #include <boost/shared_ptr.hpp>
18 
19 namespace http {
20 namespace server2 {
21 
24  : private boost::noncopyable
25 {
26 public:
28  explicit io_service_pool(std::size_t pool_size);
29 
31  void run();
32 
34  void stop();
35 
38 
39 private:
40  typedef boost::shared_ptr<asio::io_service> io_service_ptr;
41  typedef boost::shared_ptr<asio::io_service::work> work_ptr;
42 
44  std::vector<io_service_ptr> io_services_;
45 
47  std::vector<work_ptr> work_;
48 
50  std::size_t next_io_service_;
51 };
52 
53 } // namespace server2
54 } // namespace http
55 
56 #endif // HTTP_SERVER2_IO_SERVICE_POOL_HPP
Provides core I/O functionality.
Definition: io_service.hpp:184
void run()
Run all io_service objects in the pool.
A pool of io_service objects.
asio::io_service & get_io_service()
Get an io_service to use.
void stop()
Stop all io_service objects in the pool.
io_service_pool(std::size_t pool_size)
Construct the io_service pool.