CARMA C++
|
Abstract base class for PthreadCond::TimedWait based timers. More...
#include <carma/util/ScheduledTimer.h>
Public Member Functions | |
void | InterruptPresentOrNextWait () |
Interrupt the wait that is presently occurring on this timer object or if no such wait is presently occurring then preemptively interrupt the next wait that occurs. More... | |
void | WaitForNextFireTime () |
Block (the thread of the caller) until the next fire time for the timer arrives. More... | |
Protected Types | |
typedef struct::timespec | Timespec |
Static Protected Member Functions | |
static void | sanityCheckTimespec (const Timespec &ts) |
Abstract base class for PthreadCond::TimedWait based timers.
ScheduledTimer provides an abstract base class for PthreadCond::TimedWait based timers. Instances of ScheduledTimer (and of derived classes, unless their documentation says otherwise) are only intended to be used from a single thread. The behavior is undefined if multiple threads attempt to wait on the same ScheduledTimer instance. It is however, safe to have multiple threads waiting on distinct ScheduledTimer instances.
Definition at line 20 of file ScheduledTimer.h.
void carma::util::ScheduledTimer::InterruptPresentOrNextWait | ( | ) |
Interrupt the wait that is presently occurring on this timer object or if no such wait is presently occurring then preemptively interrupt the next wait that occurs.
This is the one method that can be called by any thread other than the owning thread of the timer object.
void carma::util::ScheduledTimer::WaitForNextFireTime | ( | ) |
Block (the thread of the caller) until the next fire time for the timer arrives.
That fire time is then popped from the queue of fire times. If the next fire time has already passed then this method will pop that fire time and return immediately without blocking. If multiple fire times have already passed then subsequent calls to this method will also return immediately until all fire times that have already passed have been popped from the queue. Any internal errors will throw an exception.