Iros
 
Loading...
Searching...
No Matches
wait_queue.h
Go to the documentation of this file.
1#pragma once
2
5#include "di/sync/prelude.h"
6
7namespace iris {
8class WaitQueue {
9public:
13 void notify_one(di::FunctionRef<void()> action);
14
18 void notify_all(di::FunctionRef<void()> action);
19
28 auto wait(di::FunctionRef<bool()> predicate) -> Expected<void>;
29
30private:
31 struct WaitQueueEntry : di::IntrusiveForwardListNode<> {
32 explicit WaitQueueEntry(di::Function<void()> notify_) : notify(di::move(notify_)) {}
33
34 di::Function<void()> notify;
35 };
36
38};
39}
Definition forward_list_node.h:9
Definition function.h:365
Definition function_ref.h:116
Definition synchronized.h:17
Definition wait_queue.h:8
void notify_all(di::FunctionRef< void()> action)
Notify all waiters that an event occurred.
Definition wait_queue.cpp:17
void notify_one(di::FunctionRef< void()> action)
Notify exactly one waiter that an event occurred.
Definition wait_queue.cpp:8
auto wait(di::FunctionRef< bool()> predicate) -> Expected< void >
Wait for an event to occur.
Definition wait_queue.cpp:26
Definition cxx_init.cpp:12
di::vocab::Expected< T, di::platform::GenericCode > Expected
Definition error.h:324