The Pedigree Project 0.1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Completion Class Reference

#include <Completion.h>

+ Collaboration diagram for Completion:

Public Member Functions

MUST_USE_RESULT bool wait (WaitQueue::StackDiscardCleanup onStackDiscard=nullptr, void *stackDiscardContext=nullptr)
 
bool complete ()
 
bool isComplete ()
 

Private Member Functions

 NOT_COPYABLE_OR_ASSIGNABLE (Completion)
 

Private Attributes

WaitQueue m_Waiters
 
bool m_Completed
 
bool m_WaitClaimed
 

Detailed Description

A one-shot, latched completion with an exactly-once wait claim.

complete() may run before or after wait(), including from interrupt context. Repeated completion attempts are ignored. A second call to wait() is a contract violation instead of an unexplained permanent block.

Definition at line 22 of file Completion.h.

Constructor & Destructor Documentation

◆ Completion()

Completion::Completion ( )

Definition at line 12 of file Completion.cc.

Member Function Documentation

◆ complete()

bool Completion::complete ( )

Latches completion and wakes the waiter.

Returns
true for the first completion, false for duplicates.

Definition at line 43 of file Completion.cc.

Referenced by PosixSubsystem::threadRemoved().

+ Here is the caller graph for this function:

◆ isComplete()

bool Completion::isComplete ( )

Definition at line 54 of file Completion.cc.

◆ wait()

bool Completion::wait ( WaitQueue::StackDiscardCleanup  onStackDiscard = nullptr,
void *  stackDiscardContext = nullptr 
)

Waits for completion.

A Completion has exactly one wait operation in its lifetime. A pending terminal request returns false after retiring the wait record; caller-owned state can therefore be released by ordinary scope cleanup. onStackDiscard is only a best-effort safety hook for an explicitly discarded physical stack.

Definition at line 16 of file Completion.cc.

Member Data Documentation

◆ m_Completed

bool Completion::m_Completed
private

Definition at line 52 of file Completion.h.

◆ m_WaitClaimed

bool Completion::m_WaitClaimed
private

Definition at line 53 of file Completion.h.

◆ m_Waiters

WaitQueue Completion::m_Waiters
private

Definition at line 51 of file Completion.h.


The documentation for this class was generated from the following files: