git-svn-id: svn://db.shs.com.ru/pip@836 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user