CTRE Phoenix 6 C++ 25.0.0-beta-4
|
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. | |
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.
void ctre::phoenix::threading::RcManualEvent::Clear | ( | ) |
Clear the event signal without signaling other threads.
void ctre::phoenix::threading::RcManualEvent::Reset | ( | ) |
Reset the event signal to 0 and force any threads waiting on WaitForSignal() to time out.
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.
bool ctre::phoenix::threading::RcManualEvent::WaitForSignal | ( | int | timeoutMs | ) | const |
Wait for event to be signaled, or for timeout.
timeoutMs | timeout of the wait; -1 is indefinite, 0 is a fast check |