11 #ifndef ASIO_DETAIL_EPOLL_REACTOR_HPP 12 #define ASIO_DETAIL_EPOLL_REACTOR_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 20 #if defined(ASIO_HAS_EPOLL) 44 enum op_types { read_op = 0, write_op = 1,
45 connect_op = 1, except_op = 2, max_ops = 3 };
50 friend class epoll_reactor;
51 friend class object_pool_access;
53 descriptor_state* next_;
54 descriptor_state* prev_;
57 epoll_reactor* reactor_;
59 uint32_t registered_events_;
60 op_queue<reactor_op> op_queue_[max_ops];
64 void set_ready_events(uint32_t events) { task_result_ = events; }
72 typedef descriptor_state* per_descriptor_data;
93 per_descriptor_data& descriptor_data);
97 ASIO_DECL int register_internal_descriptor(
99 per_descriptor_data& descriptor_data, reactor_op* op);
103 per_descriptor_data& target_descriptor_data,
104 per_descriptor_data& source_descriptor_data);
109 io_service_.post_immediate_completion(op, is_continuation);
115 per_descriptor_data& descriptor_data, reactor_op* op,
116 bool is_continuation,
bool allow_speculative);
122 per_descriptor_data& descriptor_data);
127 per_descriptor_data& descriptor_data,
bool closing);
130 ASIO_DECL void deregister_internal_descriptor(
131 socket_type descriptor, per_descriptor_data& descriptor_data);
134 template <
typename Time_Traits>
135 void add_timer_queue(timer_queue<Time_Traits>& timer_queue);
138 template <
typename Time_Traits>
139 void remove_timer_queue(timer_queue<Time_Traits>& timer_queue);
143 template <
typename Time_Traits>
144 void schedule_timer(timer_queue<Time_Traits>& queue,
145 const typename Time_Traits::time_type& time,
146 typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op);
150 template <
typename Time_Traits>
151 std::size_t cancel_timer(timer_queue<Time_Traits>& queue,
152 typename timer_queue<Time_Traits>::per_timer_data& timer,
153 std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)());
156 ASIO_DECL void run(
bool block, op_queue<operation>& ops);
163 enum { epoll_size = 20000 };
170 ASIO_DECL static int do_timerfd_create();
173 ASIO_DECL descriptor_state* allocate_descriptor_state();
176 ASIO_DECL void free_descriptor_state(descriptor_state*
s);
179 ASIO_DECL void do_add_timer_queue(timer_queue_base& queue);
182 ASIO_DECL void do_remove_timer_queue(timer_queue_base& queue);
192 #if defined(ASIO_HAS_TIMERFD) 195 ASIO_DECL int get_timeout(itimerspec& ts);
196 #endif // defined(ASIO_HAS_TIMERFD) 214 timer_queue_set timer_queues_;
220 mutex registered_descriptors_mutex_;
223 object_pool<descriptor_state> registered_descriptors_;
226 struct perform_io_cleanup_on_block_exit;
227 friend struct perform_io_cleanup_on_block_exit;
236 #if defined(ASIO_HEADER_ONLY) 238 #endif // defined(ASIO_HEADER_ONLY) 240 #endif // defined(ASIO_HAS_EPOLL) 242 #endif // ASIO_DETAIL_EPOLL_REACTOR_HPP
Provides core I/O functionality.
class task_io_service io_service_impl
pipe_select_interrupter select_interrupter
fork_event
Fork-related event notifications.
bool is_continuation(Context &context)
Class to represent an error code value.
task_io_service_operation operation