dispenso
A library for task parallelism
 
Loading...
Searching...
No Matches
dispenso::CompletionEvent Class Reference

#include <completion_event.h>

Public Member Functions

void notify ()
 
void wait () const
 
bool completed () const
 
template<class Rep , class Period >
bool waitFor (const std::chrono::duration< Rep, Period > &relTime) const
 
template<class Clock , class Duration >
bool waitUntil (const std::chrono::time_point< Clock, Duration > &absTime) const
 
void reset ()
 

Detailed Description

A class which can be used for one-time notify/wait scenarios. It is basically a way to signal to any waiting threads that some event has completed. There must be a single publisher thread and zero or more waiters on arbitrary threads. reset may be called to restart a sequence (e.g. after notify occurs and all waiters have successfully exited wait*).

Definition at line 29 of file completion_event.h.

Member Function Documentation

◆ completed()

bool dispenso::CompletionEvent::completed ( ) const
inline

Peek to see if the event has been notified in any thread

Definition at line 49 of file completion_event.h.

◆ notify()

void dispenso::CompletionEvent::notify ( )
inline

Notify any waiting threads that the event has completed. It is safe for this to be called before threads call wait.

Definition at line 35 of file completion_event.h.

◆ reset()

void dispenso::CompletionEvent::reset ( )
inline

Resets the event to "not-completed". This should not be called while an active wait*\/notify sequence is still currently in play.

Definition at line 79 of file completion_event.h.

◆ wait()

void dispenso::CompletionEvent::wait ( ) const
inline

Wait for another thread to notify

Definition at line 42 of file completion_event.h.

◆ waitFor()

template<class Rep , class Period >
bool dispenso::CompletionEvent::waitFor ( const std::chrono::duration< Rep, Period > &  relTime) const
inline

Wait for another thread to notify or for the relative timeout to expire, whichever is first.

Returns
true if status is "completed", false if timed out.

Definition at line 60 of file completion_event.h.

◆ waitUntil()

template<class Clock , class Duration >
bool dispenso::CompletionEvent::waitUntil ( const std::chrono::time_point< Clock, Duration > &  absTime) const
inline

Wait for another thread to notify or for the absolute timeout to expire, whichever is first.

Returns
true if status is "completed", false if timed out.

Definition at line 71 of file completion_event.h.


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