19#include "pw_async2/future_task.h"
20#include "pw_async2/runnable_dispatcher.h"
21#include "pw_async2/waker.h"
35template <
typename Native>
87 return tasks_polled_.load(std::memory_order_relaxed);
92 return tasks_completed_.load(std::memory_order_relaxed);
97 return wake_count_.load(std::memory_order_relaxed);
102 class IdleTask :
public Task {
106 ~IdleTask()
override;
109 should_complete_.store(
true, std::memory_order_relaxed);
115 should_complete_.store(
false, std::memory_order_relaxed);
119 Poll<> DoPend(Context& cx)
override;
122 std::atomic<bool> should_complete_ =
false;
127 bool DoRunUntilStalled()
override;
137 bool blocking_is_allowed_ =
false;
138 std::atomic<int> blocking_until_released_ =
false;
141 std::atomic<uint32_t> tasks_polled_ = 0u;
142 std::atomic<uint32_t> tasks_completed_ = 0u;
143 std::atomic<uint32_t> wake_count_ = 0u;
150#include "pw_async2_backend/native_dispatcher_for_test.h"
152namespace pw::async2 {
Definition: dispatcher_for_test.h:36
void RunToCompletionUntilReleased()
uint32_t wake_count() const
Returns the total number of times the dispatcher has been woken.
Definition: dispatcher_for_test.h:96
DispatcherForTestFacade()=default
DispatcherForTest is default constructible.
uint32_t tasks_polled() const
Definition: dispatcher_for_test.h:86
uint32_t tasks_completed() const
Returns the total number of tasks the dispatcher has run to completion.
Definition: dispatcher_for_test.h:91
auto RunInTaskUntilStalled(T &future)
Runs a future in a FutureTask until no progress can be made.
Definition: dispatcher_for_test.h:55
void DoWaitForWake() override
void AllowBlocking()
Definition: dispatcher_for_test.h:51
Definition: future_task.h:39
Poll< value_type > TakePoll()
Definition: future_task.h:64
Definition: runnable_dispatcher.h:24
bool RunUntilStalled()
Definition: runnable_dispatcher.h:30
bool IsRegistered() const
#define PW_ASYNC_TASK_NAME(name)
Generates a token for use as a task name.
Definition: task.h:35
#define PW_LOCKS_EXCLUDED(...)
Definition: lock_annotations.h:176