change last logic to PIThreadNotifier
This commit is contained in:
@@ -908,9 +908,7 @@ void PIThread::_endThread() {
|
||||
PIScopeExitCall ec([this] {
|
||||
terminating = running_ = false;
|
||||
tid_ = -1;
|
||||
state_mutex.lock();
|
||||
state_var.notifyAll();
|
||||
state_mutex.unlock();
|
||||
state_notifier.notify();
|
||||
});
|
||||
// PICout(PICoutManipulators::DefaultControls) << "thread" << this << "stop" << "...";
|
||||
stopped();
|
||||
@@ -1078,9 +1076,7 @@ void PIThread::setThreadName() {
|
||||
|
||||
bool PIThread::_waitForFinish(PISystemTime max_tm) {
|
||||
if (!running_) return true;
|
||||
state_mutex.lock();
|
||||
state_var.waitFor(state_mutex, max_tm);
|
||||
state_mutex.unlock();
|
||||
state_notifier.waitFor(max_tm);
|
||||
if (!running_) return true;
|
||||
#ifdef WINDOWS
|
||||
if (!isExists(PRIVATE->thread)) {
|
||||
|
||||
Reference in New Issue
Block a user