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

Base of timers: after start(), expired() is run in the Task returned by task() every duration() milliseconds (or once if repetitive() is 0) until cancel(). More...

#include <Timer.hh>

Inherits Pds::Routine.

Public Member Functions

 Timer ()
 Create the service routine for this timer.
 
virtual ~Timer ()
 Does nothing; empty virtual destructor.
 
unsigned start ()
 Arm the timer (TimerServiceRoutine::armTimer()); returns 0, or 1 if it was already running.
 
unsigned cancel ()
 Disarm the timer and, if it was running, make sure no expired() call is pending: remove it from the queue when called from the user task, else wait until the user task has drained its queue.
 
virtual void expired ()=0
 Pure virtual: the user code run in task() when the timer expires.
 
virtual Task * task ()=0
 Pure virtual: the Task in which expired() runs.
 
virtual unsigned duration () const =0
 Pure virtual: the timer period in milliseconds (per the comment).
 
virtual unsigned repetitive () const =0
 Pure virtual: 0 for a one-shot timer, non-zero for a repeating one (per the comment).
 
- Public Member Functions inherited from Pds::Routine
virtual ~Routine ()
 Does nothing; empty virtual destructor.
 
- Public Member Functions inherited from Pds::Entry
 Entry ()
 Construct an entry whose links point to itself.
 
Entry * insert (Entry *after)
 Insert this entry after after and return after.
 
Entry * insertList (Entry *after)
 Splice the list that this entry belongs to (from this entry to its predecessor) in after after; returns after.
 
Entry * remove ()
 Unlink this entry from its list, relink it to itself and return it.
 
Entry * next () const
 Return the next entry.
 
Entry * previous () const
 Return the previous entry.
 

Detailed Description

Base of timers: after start(), expired() is run in the Task returned by task() every duration() milliseconds (or once if repetitive() is 0) until cancel().

The header comment requires cancel() before destruction.

Constructor & Destructor Documentation

◆ Timer()

Pds::Timer::Timer ( )

Create the service routine for this timer.

◆ ~Timer()

virtual Pds::Timer::~Timer ( )
virtual

Does nothing; empty virtual destructor.

Member Function Documentation

◆ cancel()

unsigned Pds::Timer::cancel ( )

Disarm the timer and, if it was running, make sure no expired() call is pending: remove it from the queue when called from the user task, else wait until the user task has drained its queue.

Returns 0, or 1 if the timer was not running.

◆ duration()

virtual unsigned Pds::Timer::duration ( ) const
pure virtual

Pure virtual: the timer period in milliseconds (per the comment).

◆ expired()

virtual void Pds::Timer::expired ( )
pure virtual

Pure virtual: the user code run in task() when the timer expires.

◆ repetitive()

virtual unsigned Pds::Timer::repetitive ( ) const
pure virtual

Pure virtual: 0 for a one-shot timer, non-zero for a repeating one (per the comment).

◆ start()

unsigned Pds::Timer::start ( )

Arm the timer (TimerServiceRoutine::armTimer()); returns 0, or 1 if it was already running.

◆ task()

virtual Task * Pds::Timer::task ( )
pure virtual

Pure virtual: the Task in which expired() runs.


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