43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
/*************************************************************************\
|
|
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
|
* National Laboratory.
|
|
* Copyright (c) 2002 The Regents of the University of California, as
|
|
* Operator of Los Alamos National Laboratory.
|
|
* EPICS BASE Versions 3.13.7
|
|
* and higher are distributed subject to a Software License Agreement found
|
|
* in file LICENSE that is included with this distribution.
|
|
\*************************************************************************/
|
|
#include <stdio.h>
|
|
|
|
#include "epicsTimer.h"
|
|
|
|
class something : public epicsTimerNotify {
|
|
public:
|
|
something(const char* nm,epicsTimerQueueActive &queue)
|
|
: name(nm), timer(queue.createTimer()) {}
|
|
virtual ~something() { timer.destroy();}
|
|
void start(double delay) {timer.start(*this,delay);}
|
|
virtual expireStatus expire(const epicsTime & currentTime) {
|
|
printf("%s\n",name);
|
|
currentTime.show(1);
|
|
return(noRestart);
|
|
}
|
|
private:
|
|
const char* name;
|
|
epicsTimer &timer;
|
|
};
|
|
|
|
void epicsTimerExample()
|
|
{
|
|
epicsTimerQueueActive &queue = epicsTimerQueueActive::allocate(true);
|
|
{
|
|
something first("first",queue);
|
|
something second("second",queue);
|
|
|
|
first.start(1.0);
|
|
second.start(1.5);
|
|
epicsThreadSleep(2.0);
|
|
}
|
|
queue.release();
|
|
}
|