CTRE Phoenix 6 C++ 25.0.0-beta-4
Loading...
Searching...
No Matches
ctre::phoenix::threading::ManualEvent Class Reference

Manual Event object, useful for signaling other threads about an event. More...

#include <ctre/phoenix/threading/ManualEvent.hpp>

Public Member Functions

 ManualEvent (bool initialSignal=false)
 
bool WaitForSignal (int timeoutMs) const
 Wait for event to be signaled, or for timeout.
 
void Signal ()
 Signal the event.
 
void Clear ()
 Clear the event signal without signaling other threads.
 
void Reset ()
 Reset the event signal to false and force any threads waiting on WaitForSignal() to time out.
 

Static Public Member Functions

template<typename... Event, typename = std::enable_if_t<std::conjunction_v<std::is_same<Event, ManualEvent>...>>>
static bool WaitForAllSignals (int timeoutMs, int minTimeoutMs, Event &... events)
 Waits for all events to be signaled, or for timeout.
 
static bool WaitForAllSignals (int timeoutMs, int minTimeoutMs, ManualEvent *const *events, size_t eventCnt)
 Waits for all events to be signaled, or for timeout.
 

Detailed Description

Manual Event object, useful for signaling other threads about an event.

Constructor & Destructor Documentation

◆ ManualEvent()

ctre::phoenix::threading::ManualEvent::ManualEvent ( bool initialSignal = false)
Parameters
initialSignalwhether this event defaults to signaled

Member Function Documentation

◆ Clear()

void ctre::phoenix::threading::ManualEvent::Clear ( )

Clear the event signal without signaling other threads.

◆ Reset()

void ctre::phoenix::threading::ManualEvent::Reset ( )

Reset the event signal to false and force any threads waiting on WaitForSignal() to time out.

◆ Signal()

void ctre::phoenix::threading::ManualEvent::Signal ( )

Signal the event.

Any threads waiting on WaitForSignal() will return true.

◆ WaitForAllSignals() [1/2]

template<typename... Event, typename = std::enable_if_t<std::conjunction_v<std::is_same<Event, ManualEvent>...>>>
static bool ctre::phoenix::threading::ManualEvent::WaitForAllSignals ( int timeoutMs,
int minTimeoutMs,
Event &... events )
inlinestatic

Waits for all events to be signaled, or for timeout.

Parameters
timeoutMstimeout of the wait; -1 is indefinite, 0 is a fast check
minTimeoutMswhen timeoutMs > 0, minimum amount of time to wait for a signal; this can be used to ensure that a non-zero timeout is used for every signal; typically 0 or 1 ms
eventscomma-separated list of event references to wait on
Returns
true if all events are signaled, false if timed out

◆ WaitForAllSignals() [2/2]

static bool ctre::phoenix::threading::ManualEvent::WaitForAllSignals ( int timeoutMs,
int minTimeoutMs,
ManualEvent *const * events,
size_t eventCnt )
static

Waits for all events to be signaled, or for timeout.

Parameters
timeoutMstimeout of the wait; -1 is indefinite, 0 is a fast check
minTimeoutMswhen timeoutMs > 0, minimum amount of time to wait for a signal; this can be used to ensure that a non-zero timeout is used for every signal; typically 0 or 1 ms
eventspointer to an array of event pointers to wait on
eventCntnumber of events in the array
Returns
true if all events are signaled, false if timed out

◆ WaitForSignal()

bool ctre::phoenix::threading::ManualEvent::WaitForSignal ( int timeoutMs) const

Wait for event to be signaled, or for timeout.

Parameters
timeoutMstimeout of the wait; -1 is indefinite, 0 is a fast check
Returns
true if event is signaled, false if timed out

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