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

This commit is contained in:
2019-08-06 13:52:22 +00:00
parent 0e153f12ca
commit 4a8aef30c4
5 changed files with 37 additions and 27 deletions

View File

@@ -828,7 +828,12 @@ public:
static PIMutex & __meta_mutex();
static PIMap<PIString, __MetaData> & __meta_data(); // [classname]=__MetaData
//! \brief Execute all posted events from CONNECTU_QUEUED connections
void callQueuedEvents();
//! \brief Check if any CONNECTU_QUEUED connections to this object and execute them.
//! \details This function is more optimized than \a callQueuedEvents() for objects that doesn`t
//! appears as \"performer\" target at CONNECTU_QUEUED
bool maybeCallQueuedEvents() {if (proc_event_queue) callQueuedEvents(); return proc_event_queue;}
protected:

View File

@@ -1,10 +1,9 @@
// 108 141 174 cmake version offset
#ifndef PIVERSION_H
#define PIVERSION_H
#define PIP_VERSION_MAJOR 1
#define PIP_VERSION_MINOR 9
#define PIP_VERSION_REVISION 2
#define PIP_VERSION_SUFFIX ""
#define PIP_VERSION_MINOR 10
#define PIP_VERSION_REVISION 0
#define PIP_VERSION_SUFFIX "_alpha"
#endif // PIVERSION_H

View File

@@ -521,6 +521,7 @@ bool PITimer::isStopped() const {
void PITimer::initFirst() {
lockRun = false;
callEvents = true;
data_t = 0;
ret_func = 0;
imp = 0;
@@ -564,7 +565,7 @@ void PITimer::tickImp() {
if (ret_func) ret_func(data_t, 1);
tick(data_t, 1);
tickEvent(data_t, 1);
maybeCallQueuedEvents();
if (callEvents) maybeCallQueuedEvents();
piForeach (Delimiter & i, delims) {
if (i.delim > ++(i.tick)) continue;
i.tick = 0;

View File

@@ -157,7 +157,15 @@ public:
void needLockRun(bool need) {lockRun = need;}
EVENT_HANDLER0(void, lock) {mutex_.lock();}
EVENT_HANDLER0(void, unlock) {mutex_.unlock();}
//! \brief Returns if timer should exec \a maybeCallQueuedEvents() at every tick.
//! By default \b true
bool isCallQueuedEvents() const {return callEvents;}
//! \brief If set timer exec \a maybeCallQueuedEvents() at every tick.
//! By default \b true
void setCallQueuedEvents(bool yes) {callEvents = yes;}
//! \brief Add frequency delimiter \b delim with optional delimiter slot \b slot.
void addDelimiter(int delim, TimerEvent slot = 0) {delims << Delimiter(slot, delim);}
@@ -233,7 +241,7 @@ protected:
virtual void tick(void * data_, int delimiter) {}
void * data_t;
volatile bool lockRun;
volatile bool lockRun, callEvents;
PIMutex mutex_;
TimerEvent ret_func;
TimerImplementation imp_mode;