16#include "pw_async2/context.h"
17#include "pw_async2/lock.h"
18#include "pw_async2/poll.h"
19#include "pw_containers/intrusive_forward_list.h"
20#include "pw_containers/intrusive_list.h"
21#include "pw_log/tokenized_args.h"
22#include "pw_sync/lock_annotations.h"
27#define PW_ASYNC_TASK_NAME(name) PW_LOG_TOKEN_EXPR("pw_async2", name)
29class NativeDispatcherBase;
77 constexpr Task(log::Token name) : name_(name) {}
81 Task& operator=(
const Task&) =
delete;
149 bool TryDeregister() PW_EXCLUSIVE_LOCKS_REQUIRED(impl::dispatcher_lock());
180 void RemoveAllWakersLocked()
181 PW_EXCLUSIVE_LOCKS_REQUIRED(impl::dispatcher_lock());
185 void AddWakerLocked(
Waker&)
186 PW_EXCLUSIVE_LOCKS_REQUIRED(impl::dispatcher_lock());
193 void RemoveWakerLocked(
Waker&)
194 PW_EXCLUSIVE_LOCKS_REQUIRED(impl::dispatcher_lock());
204 State state_ PW_GUARDED_BY(impl::dispatcher_lock()) = State::kUnposted;
212 NativeDispatcherBase* dispatcher_ PW_GUARDED_BY(impl::dispatcher_lock()) =
220 log::Token name_ = log::kDefaultToken;
Definition: intrusive_forward_list.h:86
A single-threaded cooperatively-scheduled runtime for async tasks.
Definition: dispatcher.h:46
Definition: dispatcher_base.h:47
void Destroy()
Definition: task.h:142
virtual Poll DoPend(Context &)=0
constexpr Task(log::Token name)
Definition: task.h:77
Poll Pend(Context &cx)
Definition: task.h:108
bool IsRegistered() const
virtual void DoDestroy()
Definition: task.h:177
Definition: intrusive_list.h:82