Commit 6a45324e by Eric Fiselier

Address review comments.

parent b195f825
...@@ -206,11 +206,10 @@ class TimerManager { ...@@ -206,11 +206,10 @@ class TimerManager {
void RemoveErroredThread() EXCLUDES(lock_) { void RemoveErroredThread() EXCLUDES(lock_) {
MutexLock ml(lock_); MutexLock ml(lock_);
int last_thread = --running_threads_ == 0; int last_thread = --running_threads_ == 0;
if (last_thread && running_) { if (last_thread && running_)
InternalStop(); InternalStop();
} else if (!last_thread){ else if (!last_thread)
phase_condition_.notify_all(); phase_condition_.notify_all();
}
} }
// REQUIRES: timer is not running // REQUIRES: timer is not running
...@@ -279,13 +278,10 @@ class TimerManager { ...@@ -279,13 +278,10 @@ class TimerManager {
return this->phase_number_ > phase_number_cp || return this->phase_number_ > phase_number_cp ||
entered_ == running_threads_; // A thread has aborted in error entered_ == running_threads_; // A thread has aborted in error
}; };
while (true) { phase_condition_.wait(ml.native_handle(), cb);
phase_condition_.wait(ml.native_handle(), cb); if (phase_number_ > phase_number_cp)
if (phase_number_ > phase_number_cp)
return false; return false;
else if (running_threads_ == entered_) // else (running_threads_ == entered_) and we are the last thread.
break;
}
} }
// Last thread has reached the barrier // Last thread has reached the barrier
phase_number_++; phase_number_++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment