|
lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
|
UNIX implementation of a Timer: a separate service Task waits on a condition variable with a deadline and, on timeout, queues the Timer on its user task. More...
#include <Timer.hh>
Inherits Pds::Routine.
Public Member Functions | |
| TimerServiceRoutine (Timer *timer) | |
| Keep timer and initialize the status mutex and condition variable; the service task is created on the first armTimer(). | |
| virtual | ~TimerServiceRoutine () |
| Destroy the condition variable and mutex, and destroy the service task if one was created. | |
| unsigned | armTimer () |
| Create the service task on first use (named after the user task, same priority), then if the timer is off, turn it on, set the delay to duration() (minus 10 ms when above 10 ms) and queue the wait. | |
| unsigned | disarmTimer () |
| If the timer is on, turn it off, wake the service task and wait until it has finished; returns 0, or 1 if it was already off. | |
| void | submit () |
| Queue the wait routine on the service task if the timer is on. | |
UNIX implementation of a Timer: a separate service Task waits on a condition variable with a deadline and, on timeout, queues the Timer on its user task.
| Pds::TimerServiceRoutine::TimerServiceRoutine | ( | Timer * | timer | ) |
Keep timer and initialize the status mutex and condition variable; the service task is created on the first armTimer().
|
virtual |
Destroy the condition variable and mutex, and destroy the service task if one was created.
| unsigned Pds::TimerServiceRoutine::armTimer | ( | ) |
Create the service task on first use (named after the user task, same priority), then if the timer is off, turn it on, set the delay to duration() (minus 10 ms when above 10 ms) and queue the wait.
Returns 0 if armed, 1 if it was already on.
| unsigned Pds::TimerServiceRoutine::disarmTimer | ( | ) |
If the timer is on, turn it off, wake the service task and wait until it has finished; returns 0, or 1 if it was already off.
| void Pds::TimerServiceRoutine::submit | ( | ) |
Queue the wait routine on the service task if the timer is on.