Manual Event object, useful for signaling other threads about an event.
More...
#include <ctre/phoenix/threading/ManualEvent.hpp>
|
| 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.
|
|
|
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.
|
|
Manual Event object, useful for signaling other threads about an event.
◆ ManualEvent()
ctre::phoenix::threading::ManualEvent::ManualEvent |
( |
bool | initialSignal = false | ) |
|
- Parameters
-
initialSignal | whether this event defaults to signaled |
◆ 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 |
( |
| ) |
|
◆ 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
-
timeoutMs | timeout of the wait; -1 is indefinite, 0 is a fast check |
minTimeoutMs | when 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 |
events | comma-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
-
timeoutMs | timeout of the wait; -1 is indefinite, 0 is a fast check |
minTimeoutMs | when 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 |
events | pointer to an array of event pointers to wait on |
eventCnt | number 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
-
timeoutMs | timeout 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: