pithread, pitimer stop, stopAndWait
This commit is contained in:
@@ -274,15 +274,12 @@ bool _PITimerImp_Thread::startTimer(double interval_ms) {
|
||||
|
||||
|
||||
bool _PITimerImp_Thread::stopTimer(bool wait) {
|
||||
#ifndef FREERTOS
|
||||
thread_.stop(wait);
|
||||
#else
|
||||
thread_.stop();
|
||||
if (wait)
|
||||
if (!thread_.waitForFinish(10))
|
||||
if (thread_.isRunning())
|
||||
thread_.terminate();
|
||||
#endif
|
||||
if (wait) return thread_.waitForFinish();
|
||||
// if (wait)
|
||||
// if (!thread_.waitForFinish(10))
|
||||
// if (thread_.isRunning())
|
||||
// thread_.terminate();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -739,3 +736,9 @@ bool PITimer::waitForFinish(int timeout_msecs) {
|
||||
piMinSleep();
|
||||
return tm.elapsed_m() < timeout_msecs;
|
||||
}
|
||||
|
||||
void PITimer::stopAndWait(int timeout_ms) {
|
||||
init();
|
||||
imp->stop(false);
|
||||
waitForFinish(timeout_ms);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user