thread/WindowsCond: add wait() overload with predicate
This commit is contained in:
parent
230ca2e968
commit
72fc117393
@ -63,6 +63,13 @@ public:
|
|||||||
INFINITE);
|
INFINITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename M, typename P>
|
||||||
|
void wait(std::unique_lock<M> &lock,
|
||||||
|
P &&predicate) noexcept {
|
||||||
|
while (!predicate())
|
||||||
|
wait(lock);
|
||||||
|
}
|
||||||
|
|
||||||
bool wait_for(std::unique_lock<CriticalSection> &lock,
|
bool wait_for(std::unique_lock<CriticalSection> &lock,
|
||||||
std::chrono::steady_clock::duration timeout) noexcept {
|
std::chrono::steady_clock::duration timeout) noexcept {
|
||||||
auto timeout_ms = std::chrono::duration_cast<std::chrono::milliseconds>(timeout).count();
|
auto timeout_ms = std::chrono::duration_cast<std::chrono::milliseconds>(timeout).count();
|
||||||
|
Loading…
Reference in New Issue
Block a user