5 #ifndef PACKIO_MANUAL_STRAND_H
6 #define PACKIO_MANUAL_STRAND_H
11 #include "movable_function.h"
16 template <
typename Executor>
19 using function_type = movable_function<void()>;
21 explicit manual_strand(net::strand<Executor>& strand) : strand_{strand} {}
23 void push(function_type
function)
25 net::dispatch(strand_, [
this,
function = std::move(
function)]()
mutable {
26 queue_.push(std::move(
function));
37 net::dispatch(strand_, [
this] { execute(); });
48 auto function = std::move(queue_.front());
53 net::strand<Executor>& strand_;
54 std::queue<function_type> queue_;
55 bool executing_{
false};
The packio namespace.
Definition: arg.h:14