21Promise<void>
innerSubmitWork(
const Loop &loop, std::function<
void()> work);
26 requires std::is_void_v<R> || std::is_move_constructible_v<R>
28 std::optional<std::variant<R, std::exception_ptr>> result;
30 std::function<void()> agnosticWork = [&result, work]() {
34 result = std::current_exception();
38 BOOST_ASSERT(result.has_value());
39 if (result->index() == 1) {
40 std::rethrow_exception(std::get<std::exception_ptr>(*result));
42 co_return std::get<R>(std::move(*result));
46Promise<void>
submitWork(
const Loop &loop, std::function<
void()> work);
66 if (
value !=
nullptr) {
67 delete static_cast<T *
>(
value);
75 if (
value ==
nullptr) {
79 return *
static_cast<T *
>(
value);
Definition async_work.h:53
ThreadLocalKey(ThreadLocalKey &&)=default
void del()
Definition async_work.h:64
ThreadLocalKey & operator=(const ThreadLocalKey &)=default
ThreadLocalKey & operator=(ThreadLocalKey &&)=default
~ThreadLocalKey()=default
ThreadLocalKey()
Definition async_work.h:55
ThreadLocalKey(const ThreadLocalKey &)=default
T & getOrDefault()
Get the stored value, or create a new one if none exists.
Definition async_work.h:73
void setCopy(const T &value)
Set the stored value.
Definition async_work.h:89
uv_key_t key_
Definition async_work.h:92
void set(T &&value)
Set the stored value.
Definition async_work.h:86
T & get()
Get the stored value. If none exists, this will crash.
Definition async_work.h:83
Promise< void > innerSubmitWork(const Loop &loop, std::function< void()> work)
Do not use; instead, use submitWork<void>().
Definition async_work.cc:87
Promise< void > submitWork(const Loop &loop, std::function< void()> work)
Definition async_work.cc:96
Definition async_work.cc:17