X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fthread_win32.h;h=2578c8859b1cf5e279cce72b7f684c075dce6c18;hb=9742fb10fd83e82ad760e4cac5cef3d6dff670ed;hp=a3abd65cbfb7863913fa0ab1b11c569d00d1d6b1;hpb=6027652773c8fbf10ea2c38abd4445dd54bfd8e7;p=stockfish diff --git a/src/thread_win32.h b/src/thread_win32.h index a3abd65c..2578c885 100644 --- a/src/thread_win32.h +++ b/src/thread_win32.h @@ -1,7 +1,7 @@ /* Stockfish, a UCI chess playing engine derived from Glaurung 2.1 Copyright (C) 2004-2008 Tord Romstad (Glaurung author) - Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad + Copyright (C) 2008-2016 Marco Costalba, Joona Kiiski, Tord Romstad Stockfish is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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