void PeriodicTask::stop() { asyncStop(); if (os::gettid() == _p->_tid) return; boost::mutex::scoped_lock l(_p->_mutex); while (_p->_state == TaskState::Stopping) _p->_cond.wait(l); }
void PeriodicTask::stop() { asyncStop(); if (os::gettid() == _p->_tid) return; try { _p->_task.wait(); } catch (...) {} // So here state can be stopping (callback was aborted) or stopped // We set to stopped either way to be ready for restart. if (!_p->_state.setIfEquals(Task_Stopping , Task_Stopped) && !_p->_state.setIfEquals(Task_Stopped, Task_Stopped)) qiLogError() << "PeriodicTask inconsistency, expected Stopped, got " << *_p->_state; }
void MainDialog::onStop() { QTimer::singleShot(0, this, SLOT(asyncStop())); }