git-svn-id: svn://db.shs.com.ru/pip@758 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -62,7 +62,7 @@ _PITimerBase::_PITimerBase() {
|
||||
void _PITimerBase::setInterval(double i) {
|
||||
interval_ = i;
|
||||
if (isRunning()) {
|
||||
piCout << "change interval runtime";
|
||||
//piCout << "change interval runtime";
|
||||
stop(true);
|
||||
start();
|
||||
}
|
||||
@@ -73,7 +73,7 @@ bool _PITimerBase::start(double interval_ms) {
|
||||
if (isRunning()) stop(true);
|
||||
deferred_ = false;
|
||||
setInterval(interval_ms);
|
||||
piCout << "_PITimerBase::startTimer"<<interval_ms<<"...";
|
||||
//piCout << "_PITimerBase::startTimer"<<interval_ms<<"...";
|
||||
running_ = startTimer(interval_ms);
|
||||
return running_;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ void _PITimerBase::startDeferred(double interval_ms, double delay_ms) {
|
||||
bool _PITimerBase::stop(bool wait) {
|
||||
//piCout << GetCurrentThreadId() << "_PITimerBase::stop" << wait << isRunning();
|
||||
if (!isRunning()) return true;
|
||||
piCout << "_PITimerBase::stopTimer ...";
|
||||
//piCout << "_PITimerBase::stopTimer ...";
|
||||
running_ = !stopTimer(wait);
|
||||
return !running_;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ _PITimerImp_Thread::_PITimerImp_Thread() {
|
||||
wait_dt = 100;
|
||||
wait_dd = 200;
|
||||
wait_tick = 10;
|
||||
piCout << "_PITimerImp_Thread" << this << ", thread& =" << &thread_;
|
||||
//piCout << "_PITimerImp_Thread" << this << ", thread& =" << &thread_;
|
||||
//piCout << "new _PITimerImp_Thread";
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ bool _PITimerImp_Thread::startTimer(double interval_ms) {
|
||||
|
||||
bool _PITimerImp_Thread::stopTimer(bool wait) {
|
||||
#ifndef FREERTOS
|
||||
thread_.stop(true);
|
||||
thread_.stop(wait);
|
||||
#else
|
||||
thread_.stop();
|
||||
if (wait)
|
||||
@@ -250,9 +250,9 @@ bool _PITimerImp_Thread::threadFunc() {
|
||||
st_wait = st_time - PISystemTime::current(true);
|
||||
//piCout << "wait" << this << st_wait;
|
||||
if (st_wait.abs() > st_odt || st_wait.seconds <= -5) {
|
||||
piCout << &thread_ << "adjust" << "...";
|
||||
//piCout << &thread_ << "adjust" << "...";
|
||||
adjustTimes();
|
||||
piCout << &thread_ << "adjust" << "ok";
|
||||
//piCout << &thread_ << "adjust" << "ok";
|
||||
return true;
|
||||
}
|
||||
if (wait_tick > 0) {
|
||||
@@ -260,7 +260,7 @@ bool _PITimerImp_Thread::threadFunc() {
|
||||
piMSleep(wait_tick);
|
||||
return false;
|
||||
} else {
|
||||
piCout << &thread_ << "sleep for" << st_wait;
|
||||
//piCout << &thread_ << "sleep for" << st_wait;
|
||||
st_wait.sleep();
|
||||
}
|
||||
} else {
|
||||
@@ -272,9 +272,9 @@ bool _PITimerImp_Thread::threadFunc() {
|
||||
piCout << "Achtung! PITimer \"parent\" is not PIObject!";
|
||||
return false;
|
||||
}
|
||||
piCout << &thread_ << "tfunc" << "...";
|
||||
//piCout << &thread_ << "tfunc" << "...";
|
||||
tfunc(parent);
|
||||
piCout << &thread_ << "tfunc" << "ok";
|
||||
//piCout << &thread_ << "tfunc" << "ok";
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -548,7 +548,7 @@ void PITimer::init() const {
|
||||
default: piCout << "Fatal: invalid implementation() of" << this << "!"; assert(0);
|
||||
}
|
||||
if (!imp) return;
|
||||
piCout << this << "init" << imp;
|
||||
//piCout << this << "init" << imp;
|
||||
imp->tfunc = tickImpS;
|
||||
imp->parent = const_cast<PITimer*>(this);
|
||||
}
|
||||
@@ -556,7 +556,7 @@ void PITimer::init() const {
|
||||
|
||||
void PITimer::destroy() {
|
||||
if (!imp) return;
|
||||
piCout << this << "destroy" << imp;
|
||||
//piCout << this << "destroy" << imp;
|
||||
imp->stop(false); ///BUG: WTF FreeRTOS segfault on this!
|
||||
delete imp;
|
||||
imp = 0;
|
||||
@@ -583,14 +583,14 @@ void PITimer::tickImp() {
|
||||
|
||||
|
||||
bool PITimer::start() {
|
||||
piCout << this << "start" << imp;
|
||||
//piCout << this << "start" << imp;
|
||||
return imp->start();
|
||||
}
|
||||
|
||||
|
||||
bool PITimer::start(double interval_ms_d) {
|
||||
init();
|
||||
piCout << this << "start" << imp << interval_ms_d;
|
||||
//piCout << this << "start" << imp << interval_ms_d;
|
||||
setProperty("interval", interval_ms_d);
|
||||
return imp->start(interval_ms_d);
|
||||
}
|
||||
@@ -638,7 +638,7 @@ bool PITimer::stop() {
|
||||
|
||||
bool PITimer::stop(bool wait) {
|
||||
init();
|
||||
piCout << this << "stop" << imp << wait;
|
||||
//piCout << this << "stop" << imp << wait;
|
||||
return imp->stop(wait);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user