lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::TimerServiceRoutine Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ TimerServiceRoutine()

Pds::TimerServiceRoutine::TimerServiceRoutine ( Timer *  timer)

Keep timer and initialize the status mutex and condition variable; the service task is created on the first armTimer().

◆ ~TimerServiceRoutine()

virtual Pds::TimerServiceRoutine::~TimerServiceRoutine ( )
virtual

Destroy the condition variable and mutex, and destroy the service task if one was created.

Member Function Documentation

◆ armTimer()

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.

◆ disarmTimer()

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.

◆ submit()

void Pds::TimerServiceRoutine::submit ( )

Queue the wait routine on the service task if the timer is on.


The documentation for this class was generated from the following file: