X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fthread_win32.h;fp=src%2Fthread_win32.h;h=28c899dcf466ea82324abd6bd48b8b0b4831c9f3;hp=a3abd65cbfb7863913fa0ab1b11c569d00d1d6b1;hb=ebf3735754d015dfda72930a676b8b43f0614086;hpb=966bc477af9eae9be63b08111a76e8306263e4a3 diff --git a/src/thread_win32.h b/src/thread_win32.h index a3abd65c..28c899dc 100644 --- a/src/thread_win32.h +++ b/src/thread_win32.h @@ -57,29 +57,7 @@ private: CRITICAL_SECTION cs; }; -struct ConditionVariable { - ConditionVariable() { hn = CreateEvent(0, FALSE, FALSE, 0); } - ~ConditionVariable() { CloseHandle(hn); } - void notify_one() { SetEvent(hn); } - - void wait(std::unique_lock& lk) { - lk.unlock(); - WaitForSingleObject(hn, INFINITE); - lk.lock(); - } - - void wait_for(std::unique_lock& lk, const std::chrono::milliseconds& ms) { - lk.unlock(); - WaitForSingleObject(hn, ms.count()); - lk.lock(); - } - - template - void wait(std::unique_lock& lk, Predicate p) { while (!p()) this->wait(lk); } - -private: - HANDLE hn; -}; +typedef std::condition_variable_any ConditionVariable; #else // Default case: use STL classes