fix possibility of race condition

This commit is contained in:
2022-11-11 10:10:16 +09:00
parent 803d93f3ec
commit 1f5f46c925

View File

@@ -458,8 +458,9 @@ int main(int, char**) {
cycle_ = kSyncUpdate;
std::unique_lock<std::mutex> k {cycle_mtx_};
cycle_cv_.notify_all();
cycle_cv_.wait(k, []() { return cycle_ != kUpdate; });
cycle_cv_.wait(k, []() { return cycle_ == kUpdate; });
}
assert(cycle_ == kUpdate);
env.TearDownRoot();
// notify other threads that the destruction is done