28 m_underlying_loop(get_logger(), nickname, 1)
30 FLOW_LOG_INFO(
"Single_thread_task_loop [" <<
static_cast<const void*
>(
this) <<
"] "
31 "with nickname [" << nickname <<
"], backed by a 1-thread Cross_thread_task_loop: "
32 "Started. Above Cross_thread_task_loop messages, if any, contain details.");
37 FLOW_LOG_INFO(
"Single_thread_task_loop [" <<
this <<
"]: Destroying object: see subsequent Cross_thread_task_loop "
93 m_timed_loop(underlying_loop(), clock_type,
96 {
const auto ret = *time_acc; *time_acc = 0;
return ret; })
The core flow::async interface, providing an optionally multi-threaded thread pool onto which runnabl...
util::Scheduled_task_handle schedule_from_now(const Fine_duration &from_now, Scheduled_task &&task) override
Implements superclass API.
void start(Task &&init_task_or_empty=Task(), const Thread_init_func &thread_init_func_or_empty=Thread_init_func()) override
Implements superclass API.
void stop() override
Implements superclass API.
util::Scheduled_task_handle schedule_at(const Fine_time_pt &at, Scheduled_task &&task) override
Implements superclass API.
void post(Task &&task, Synchronicity synchronicity=Synchronicity::S_ASYNC) override
Implements superclass API.
Task_engine_ptr task_engine() override
See superclass API.
A Concurrent_task_loop-related adapter-style class that represents a single-thread task loop; essenti...
void start(Task &&init_task_or_empty=Task())
Starts the 1 thread in the thread pool; any queued post()ed (and similar) tasks may begin executing i...
virtual util::Scheduled_task_handle schedule_at(const Fine_time_pt &at, Scheduled_task &&task)
Equivalent to schedule_from_now() except one specifies an absolute time point instead of wait duratio...
Task_loop_impl m_underlying_loop
See underlying_loop().
virtual util::Scheduled_task_handle schedule_from_now(const Fine_duration &from_now, Scheduled_task &&task)
Equivalent to post() but execution is scheduled for later, after the given time period passes.
Task_engine_ptr task_engine()
Returns a pointer to the internal util::Task_engine (a/k/a boost.asio io_service) for the purpose of ...
util::Thread_id m_started_thread_id_or_none
Before start() it is default-cted (not-a-thread); from start() on it's the started thread's ID.
Concurrent_task_loop * underlying_loop()
Returns the underlying work-horse Concurrent_task_loop.
~Single_thread_task_loop() override
Executes stop() – see its doc header please – and then cleans up any resources.
void stop()
Waits for the ongoing task/completion handler – if one is running – to return; then prevents any furt...
bool in_thread() const
Returns true if and only if the thread executing this call is the thread started by start().
virtual void post(Task &&task, Synchronicity synchronicity=Synchronicity::S_ASYNC)
Cause the given Task (function) to execute within the worker thread as soon as the thread is free of ...
Single_thread_task_loop(log::Logger *logger_ptr, util::String_view nickname)
Constructs object, making it available for post() and similar work, but without starting any thread a...
util::Scheduled_task_handle schedule_at(const Fine_time_pt &at, Scheduled_task &&task) override
Implements superclass API.
perf::Duration accumulated_time()
Returns the accumulated time spent on tasks this thread pool handles since its last invocation; and r...
util::Scheduled_task_handle schedule_from_now(const Fine_duration &from_now, Scheduled_task &&task) override
Implements superclass API.
void post(Task &&task, Synchronicity synchronicity=Synchronicity::S_ASYNC) override
Implements superclass API.
Timed_single_thread_task_loop(log::Logger *logger_ptr, util::String_view nickname, perf::Clock_type clock_type=perf::Clock_type::S_CPU_THREAD_TOTAL_HI_RES)
Constructs object, similarly to Single_thread_task_loop ctor; but with timing capabilities a-la Timed...
Timed_concurrent_task_loop_impl< perf::duration_rep_t > m_timed_loop
The task-timing decorator of our superclass Single_thread_task_loop's protected superclass.
util::Scheduled_task_handle schedule_at(const Fine_time_pt &at, Scheduled_task &&task) override
Implements superclass method but with the addition of timing of task, accessible through accumulated_...
void post(Task &&task, Synchronicity synchronicity=Synchronicity::S_ASYNC) override
Implements superclass method but with the addition of timing of task, accessible through accumulated_...
perf::Duration accumulated_time()
See Timed_concurrent_task_loop_impl::accumulated_time().
util::Scheduled_task_handle schedule_from_now(const Fine_duration &from_now, Scheduled_task &&task) override
Implements superclass method but with the addition of timing of task, accessible through accumulated_...
Interface that the user should implement, passing the implementing Logger into logging classes (Flow'...
#define FLOW_LOG_INFO(ARG_stream_fragment)
Logs an INFO message into flow::log::Logger *get_logger() with flow::log::Component get_log_component...
Flow module containing tools enabling multi-threaded event loops operating under the asynchronous-tas...
Synchronicity
Enumeration indicating the manner in which asio_exec_ctx_post(), and various boost....
@ S_ASYNC
Simply post the given task to execute asynchronously in some execution context – as soon as the conte...
boost::shared_ptr< util::Task_engine > Task_engine_ptr
Short-hand for reference-counting pointer to a mutable util::Task_engine (a/k/a boost::asio::io_servi...
Fine_duration Duration
Short-hand for a high-precision boost.chrono duration, formally equivalent to flow::Fine_duration.
Duration::rep duration_rep_t
The raw type used in Duration to store its clock ticks.
Clock_type
Clock types supported by flow::perf module facilities, perf::Checkpointing_timer in particular.
boost::shared_ptr< Scheduled_task_handle_state > Scheduled_task_handle
Black-box type that represents a handle to a scheduled task as scheduled by schedule_task_at() or sch...
Basic_string_view< char > String_view
Commonly used char-based Basic_string_view. See its doc header.
Flow_log_component
The flow::log::Component payload enumeration comprising various log components used by Flow's own int...
Fine_clock::duration Fine_duration
A high-res time duration as computed from two Fine_time_pts.
Fine_clock::time_point Fine_time_pt
A high-res time point as returned by Fine_clock::now() and suitable for precise time math in general.