11 #ifndef ASIO_DETAIL_SCHEDULER_HPP 12 #define ASIO_DETAIL_SCHEDULER_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 18 #include "asio/detail/config.hpp" 20 #include "asio/error_code.hpp" 21 #include "asio/execution_context.hpp" 22 #include "asio/detail/atomic_count.hpp" 23 #include "asio/detail/conditionally_enabled_event.hpp" 24 #include "asio/detail/conditionally_enabled_mutex.hpp" 25 #include "asio/detail/op_queue.hpp" 26 #include "asio/detail/reactor_fwd.hpp" 27 #include "asio/detail/scheduler_operation.hpp" 28 #include "asio/detail/thread.hpp" 29 #include "asio/detail/thread_context.hpp" 31 #include "asio/detail/push_options.hpp" 36 struct scheduler_thread_info;
43 typedef scheduler_operation operation;
48 int concurrency_hint = 0,
bool own_thread =
true);
51 ASIO_DECL ~scheduler();
57 ASIO_DECL
void init_task();
66 ASIO_DECL std::size_t wait_one(
76 ASIO_DECL
void stop();
79 ASIO_DECL
bool stopped()
const;
82 ASIO_DECL
void restart();
92 ASIO_DECL
void compensating_work_started();
97 if (--outstanding_work_ == 0)
104 return thread_call_stack::contains(
this) != 0;
112 ASIO_DECL
void post_immediate_completion(
113 operation* op,
bool is_continuation);
117 ASIO_DECL
void post_immediate_completions(std::size_t n,
122 ASIO_DECL
void post_deferred_completion(operation* op);
130 ASIO_DECL
void do_dispatch(operation* op);
137 int concurrency_hint()
const 139 return concurrency_hint_;
168 ASIO_DECL
void wake_one_thread_and_unlock(
184 const bool one_thread_;
187 mutable mutex mutex_;
196 struct task_operation : operation
198 task_operation() : operation(0) {}
202 bool task_interrupted_;
205 atomic_count outstanding_work_;
217 const int concurrency_hint_;
226 #include "asio/detail/pop_options.hpp" 228 #if defined(ASIO_HEADER_ONLY) 229 # include "asio/detail/impl/scheduler.ipp" 230 #endif // defined(ASIO_HEADER_ONLY) 232 #endif // ASIO_DETAIL_SCHEDULER_HPP Definition: scheduler.ipp:33
Definition: conditionally_enabled_event.hpp:31
Definition: scheduler.ipp:51
Definition: scheduler_thread_info.hpp:29
Definition: execution_context.hpp:386
A context for function object execution.
Definition: execution_context.hpp:105
ASIO_DECL void capture_current_exception()
Capture the current exception so it can be rethrown from a run function.
Definition: scheduler.ipp:327
Definition: thread_context.hpp:30
Definition: conditionally_enabled_mutex.hpp:29
Definition: conditionally_enabled_mutex.hpp:34
Class to represent an error code value.
Definition: error_code.hpp:80
ASIO_DECL void shutdown()
Destroy all user-defined handler objects owned by the service.
Definition: scheduler.ipp:147
Definition: scheduler.ipp:76
Definition: null_thread.hpp:31
Definition: any_io_executor.hpp:28
Definition: scheduler.hpp:38