mirror of
https://github.com/Z3Prover/z3
synced 2025-06-26 15:53:41 +00:00
scoped_timer: wait for timer thread before main thread continues (#4803)
This commit is contained in:
parent
e16acd0965
commit
0fa88efc2b
1 changed files with 3 additions and 1 deletions
|
@ -34,7 +34,7 @@ struct scoped_timer_state {
|
||||||
std::timed_mutex m_mutex;
|
std::timed_mutex m_mutex;
|
||||||
event_handler * eh;
|
event_handler * eh;
|
||||||
unsigned ms;
|
unsigned ms;
|
||||||
int work;
|
std::atomic<int> work;
|
||||||
std::condition_variable_any cv;
|
std::condition_variable_any cv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -102,6 +102,8 @@ public:
|
||||||
|
|
||||||
~imp() {
|
~imp() {
|
||||||
s->m_mutex.unlock();
|
s->m_mutex.unlock();
|
||||||
|
while (s->work == 1)
|
||||||
|
std::this_thread::yield();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue