C/C++ API Reference
Loading...
Searching...
No Matches
Wakers

Overview

Queue work in response to async events.

Learn more: Wakers

Classes

class  pw::async2::Waker
 

Macros

#define PW_ASYNC_STORE_WAKER(context, waker_or_queue_out, wait_reason_string)
 
#define PW_ASYNC_TRY_STORE_WAKER( context, waker_or_queue_out, wait_reason_string)
 
#define PW_ASYNC_CLONE_WAKER(waker_in, waker_or_queue_out, wait_reason_string)
 
#define PW_ASYNC_TRY_CLONE_WAKER( waker_in, waker_or_queue_out, wait_reason_string)
 

Macro Definition Documentation

◆ PW_ASYNC_CLONE_WAKER

#define PW_ASYNC_CLONE_WAKER (   waker_in,
  waker_or_queue_out,
  wait_reason_string 
)
Value:
do { \
bool waker_or_queue_had_space = PW_ASYNC_TRY_CLONE_WAKER( \
waker_in, waker_or_queue_out, wait_reason_string); \
PW_ASSERT(waker_or_queue_had_space); \
} while (0)
#define PW_ASYNC_TRY_CLONE_WAKER( waker_in, waker_or_queue_out, wait_reason_string)
Definition: waker.h:121

Attempts to store a waker associated with waker_in into waker_or_queue_out. If the waker cannot be stored into waker_or_queue_out due to the target waker already referencing a task or the queue being full, crashes.

When the stored waker is later awoken with :cpp:func:pw::async2::Waker::Wake, the :cpp:class:pw::async2::Task associated with cx will be awoken and its DoPend method will be invoked again.

wait_reason_string is a human-readable description of why the task is blocked. If the module configuration option PW_ASYNC2_DEBUG_WAIT_REASON is set, this string will be stored with the waker and reported by Dispatcher::LogRegisteredTasks when its associated task is blocked.

◆ PW_ASYNC_STORE_WAKER

#define PW_ASYNC_STORE_WAKER (   context,
  waker_or_queue_out,
  wait_reason_string 
)
Value:
do { \
bool waker_or_queue_had_space = PW_ASYNC_TRY_STORE_WAKER( \
context, waker_or_queue_out, wait_reason_string); \
PW_ASSERT(waker_or_queue_had_space); \
} while (0)
#define PW_ASYNC_TRY_STORE_WAKER( context, waker_or_queue_out, wait_reason_string)
Definition: waker.h:79

Attempts to store a waker associated with the current context into waker_or_queue_out. If the waker cannot be stored into waker_or_queue_out due to the target waker already referencing a task or the queue being full, crashes.

When the stored waker is later awoken with :cpp:func:pw::async2::Waker::Wake, the :cpp:class:pw::async2::Task associated with cx will be awoken and its DoPend method will be invoked again.

wait_reason_string is a human-readable description of why the task is blocked. If the module configuration option PW_ASYNC2_DEBUG_WAIT_REASON is set, this string will be stored with the waker and reported by Dispatcher::LogRegisteredTasks when its associated task is blocked.

◆ PW_ASYNC_TRY_CLONE_WAKER

#define PW_ASYNC_TRY_CLONE_WAKER (   waker_in,
  waker_or_queue_out,
  wait_reason_string 
)
Value:
_PW_ASYNC_TRY_GET_WAKER(::pw::async2::internal::CloneWaker, \
waker_in, \
waker_or_queue_out, \
wait_reason_string)

Attempts to store a waker associated with waker_in into waker_or_queue_out. If the waker cannot be stored into waker_or_queue_out due to the target waker already referencing a task or the queue being full, returns false and does not modify it.

When the stored waker is later awoken with :cpp:func:pw::async2::Waker::Wake, the :cpp:class:pw::async2::Task associated with cx will be awoken and its DoPend method will be invoked again.

wait_reason_string is a human-readable description of why the task is blocked. If the module configuration option PW_ASYNC2_DEBUG_WAIT_REASON is set, this string will be stored with the waker and reported by Dispatcher::LogRegisteredTasks when its associated task is blocked.

◆ PW_ASYNC_TRY_STORE_WAKER

#define PW_ASYNC_TRY_STORE_WAKER (   context,
  waker_or_queue_out,
  wait_reason_string 
)
Value:
_PW_ASYNC_TRY_GET_WAKER(::pw::async2::internal::StoreWaker, \
context, \
waker_or_queue_out, \
wait_reason_string)

Attempts to store a waker associated with the current context into waker_or_queue_out. If the waker cannot be stored into waker_or_queue_out due to the target waker already referencing a task or the queue being full, returns false and does not modify it.

When the stored waker is later awoken with :cpp:func:pw::async2::Waker::Wake, the :cpp:class:pw::async2::Task associated with cx will be awoken and its DoPend method will be invoked again.

wait_reason_string is a human-readable description of why the task is blocked. If the module configuration option PW_ASYNC2_DEBUG_WAIT_REASON is set, this string will be stored with the waker and reported by Dispatcher::LogRegisteredTasks when its associated task is blocked.