mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 00:56:39 +08:00
Add thread_win32.h header
Workaround slow std::thread implementation in mingw and gcc for Windows with our own old low level thread functions. No functional change.
This commit is contained in:
@@ -61,7 +61,7 @@ namespace {
|
||||
|
||||
void ThreadBase::notify_one() {
|
||||
|
||||
std::unique_lock<std::mutex>(this->mutex);
|
||||
std::unique_lock<Mutex>(this->mutex);
|
||||
sleepCondition.notify_one();
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ void ThreadBase::notify_one() {
|
||||
|
||||
void ThreadBase::wait_for(volatile const bool& condition) {
|
||||
|
||||
std::unique_lock<std::mutex> lk(mutex);
|
||||
std::unique_lock<Mutex> lk(mutex);
|
||||
sleepCondition.wait(lk, [&]{ return condition; });
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ void TimerThread::idle_loop() {
|
||||
|
||||
while (!exit)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(mutex);
|
||||
std::unique_lock<Mutex> lk(mutex);
|
||||
|
||||
if (!exit)
|
||||
sleepCondition.wait_for(lk, std::chrono::milliseconds(run ? Resolution : INT_MAX));
|
||||
@@ -244,7 +244,7 @@ void MainThread::idle_loop() {
|
||||
|
||||
while (!exit)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(mutex);
|
||||
std::unique_lock<Mutex> lk(mutex);
|
||||
|
||||
thinking = false;
|
||||
|
||||
@@ -340,7 +340,7 @@ Thread* ThreadPool::available_slave(const SplitPoint* sp) const {
|
||||
|
||||
void ThreadPool::wait_for_think_finished() {
|
||||
|
||||
std::unique_lock<std::mutex> lk(main()->mutex);
|
||||
std::unique_lock<Mutex> lk(main()->mutex);
|
||||
sleepCondition.wait(lk, [&]{ return !main()->thinking; });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user