8 #include<libtransistor/cpp/types.hpp>
19 class WaitHandle :
public std::enable_shared_from_this<WaitHandle> {
21 WaitHandle(
Waiter *waiter, std::variant<std::unique_ptr<std::function<
bool()>>, std::unique_ptr<std::function<uint64_t()>>> callback);
28 wait_record_t *record;
31 static bool EventShim(
void *data,
handle_t handle);
32 static uint64_t DeadlineShim(
void *data);
33 static bool SignalShim(
void *data);
38 std::shared_ptr<WaitHandle>
self = shared_from_this();
40 if((*std::get<std::unique_ptr<std::function<R()>>>(callback))()) {
48 std::variant<std::unique_ptr<std::function<bool()>>, std::unique_ptr<std::function<uint64_t()>>> callback;
50 bool is_cancelled =
false;
59 std::shared_ptr<WaitHandle> Add(
KWaitable &waitable, std::function<
bool()> callback);
60 std::shared_ptr<WaitHandle> AddDeadline(uint64_t deadline, std::function<uint64_t()> callback);
61 std::shared_ptr<WaitHandle> AddSignal(std::function<
bool()> callback);
62 Result<std::nullopt_t> Wait(uint64_t timeout);
Manager for waiting on synchronizable handles.
Definition: waiter.hpp:53
Definition: waiter.hpp:19
uint32_t handle_t
Resource handle.
Definition: types.h:38