Donner SVG main
0.8.0 ยท 766e862a0.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::tasks::PlatformParkerHooks< WordT > Struct Template Reference

The platform policy of a Parker over WordT: std::atomic::wait and std::atomic::notify_one, and a hook at each step of Parker::parkUntil that compiles to nothing. More...

#include "donner/base/tasks/Parker.h"

Public Types

using Word = WordT
 The parker word's type.

Static Public Member Functions

static void Wait (const std::atomic< Word > &word, Word token, std::memory_order order)
 Blocks while word holds token.
static void NotifyOne (std::atomic< Word > &word)
 Wakes the thread blocked on word, if there is one. This is the call that may enter the kernel.
static void BeforePrepareWait ()
 Called by Parker::parkUntil after its condition was false, before it sets the waiting bit.
static void AfterPrepareWait ()
 Called by Parker::parkUntil after it set the waiting bit, before its re-check.
static void BeforeWait ()
 Called by Parker::parkUntil after its re-check found the condition false, before it waits.
static void BetweenChangeAndNotify ()
 Called by Parker::unpark after its change found the waiting bit set, before it notifies.

Detailed Description

template<typename WordT>
struct donner::tasks::PlatformParkerHooks< WordT >

The platform policy of a Parker over WordT: std::atomic::wait and std::atomic::notify_one, and a hook at each step of Parker::parkUntil that compiles to nothing.

Production code uses NoParkerHooks; tests instantiate other word types, and pass policies that model the platform wait queue, count notifications, or hold the sleeper inside a hook.

Template Parameters
WordTThe parker word's type, a signed integer.

Member Function Documentation

◆ Wait()

template<typename WordT>
void donner::tasks::PlatformParkerHooks< WordT >::Wait ( const std::atomic< Word > & word,
Word token,
std::memory_order order )
inlinestatic

Blocks while word holds token.

Parameters
wordThe parker word.
tokenThe value to wait on.
orderOrdering of the loads that compare the word with token.

The documentation for this struct was generated from the following file: