3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-08 18:31:49 +00:00

scoped_timer: wait for timer thread before main thread continues (#4803)

This commit is contained in:
John Regehr 2020-11-19 14:42:55 -07:00 committed by GitHub
parent e16acd0965
commit 0fa88efc2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,7 +34,7 @@ struct scoped_timer_state {
std::timed_mutex m_mutex;
event_handler * eh;
unsigned ms;
int work;
std::atomic<int> work;
std::condition_variable_any cv;
};
@ -102,6 +102,8 @@ public:
~imp() {
s->m_mutex.unlock();
while (s->work == 1)
std::this_thread::yield();
}
};