git-svn-id: svn://db.shs.com.ru/pip@546 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2017-09-14 10:38:26 +00:00
parent 6d1852c535
commit aac78354c5
2 changed files with 27 additions and 25 deletions

View File

@@ -35,7 +35,7 @@ class _PITimerBase {
friend class PITimer;
public:
_PITimerBase();
virtual ~_PITimerBase() {stop();}
virtual ~_PITimerBase() {stop(true);}
double interval() const {return interval_;}
void setInterval(double i);
@@ -52,7 +52,7 @@ public:
void startDeferred(PIDateTime start_datetime) {startDeferred(interval_, start_datetime);}
void startDeferred(double interval_ms, PIDateTime start_datetime);
bool stop();
bool stop(bool wait);
typedef void(*TickFunc)(PITimer*);
TickFunc tfunc;
@@ -61,7 +61,7 @@ public:
protected:
virtual bool startTimer(double interval_ms) = 0;
virtual bool stopTimer() = 0;
virtual bool stopTimer(bool wait) = 0;
double interval_, deferred_delay;
bool deferred_, deferred_mode; // mode: true - date, false - delay
@@ -117,7 +117,7 @@ public:
EVENT_HANDLER0(bool, start) {return imp->start();}
EVENT_HANDLER1(bool, start, double, interval_ms_d) {setInterval(interval_ms_d); return imp->start(interval_ms_d);}
bool start(int interval_ms_i) {setInterval(double(interval_ms_i)); return imp->start(double(interval_ms_i));}
EVENT_HANDLER0(bool, restart) {imp->stop(); return imp->start();}
EVENT_HANDLER0(bool, restart) {imp->stop(true); return imp->start();}
/** \brief Start timer with \b interval() loop delay after \b delay_msecs delay.
@@ -140,7 +140,8 @@ public:
* \b interval_msecs loop delay. */
void startDeferred(double interval_ms, PIDateTime start_datetime) {imp->startDeferred(interval_ms, start_datetime);}
EVENT_HANDLER0(bool, stop) {return imp->stop();}
EVENT_HANDLER0(bool, stop) {return imp->stop(true);}
EVENT_HANDLER1(bool, stop, bool, wait) {return imp->stop(wait);}
bool waitForFinish() {return waitForFinish(-1);}
bool waitForFinish(int timeout_msecs);
@@ -194,8 +195,8 @@ public:
//! \fn bool restart()
//! \brief Stop and start timer with \a interval() loop delay
//! \fn bool stop()
//! \brief Stop timer
//! \fn bool stop(bool wait = true)
//! \brief Stop timer and wait for it finish if "wait"
//! \fn void clearDelimiters()
//! \brief Remove all frequency delimiters