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

Reference-counted Manual Event. More...

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

Public Member Functions

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 0 and force any threads waiting on WaitForSignal() to time out.
 

Detailed Description

Reference-counted Manual Event.

Each Signal() increments a reference count, and each Clear() decrements the count. The event is signaled while the count is greater than 0.

This is useful for a situation where multiple threads signal an operation to run, and the operation should not stop until all threads clear the event.

Member Function Documentation

◆ Clear()

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

Clear the event signal without signaling other threads.

◆ Reset()

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

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

◆ Signal()

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

Signal the event.

Any threads waiting on WaitForSignal() will return true. The caller must clear the signal once it is done, otherwise the reference count may never return to 0.

◆ WaitForSignal()

bool ctre::phoenix::threading::RcManualEvent::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: