mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-25 19:46:55 +08:00
Merge remote-tracking branch 'upstream/master' into data_generation
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
|
||||
Copyright (C) 2004-2020 The Stockfish developers (see AUTHORS file)
|
||||
Copyright (C) 2004-2021 The Stockfish developers (see AUTHORS file)
|
||||
|
||||
Stockfish is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "syzygy/tbprobe.h"
|
||||
#include "tt.h"
|
||||
|
||||
namespace Stockfish {
|
||||
|
||||
ThreadPool Threads; // Global object
|
||||
|
||||
|
||||
@@ -151,14 +153,16 @@ void Thread::idle_loop() {
|
||||
|
||||
void ThreadPool::set(size_t requested) {
|
||||
|
||||
if (size() > 0) { // destroy any existing thread(s)
|
||||
if (size() > 0) // destroy any existing thread(s)
|
||||
{
|
||||
main()->wait_for_search_finished();
|
||||
|
||||
while (size() > 0)
|
||||
delete back(), pop_back();
|
||||
}
|
||||
|
||||
if (requested > 0) { // create new thread(s)
|
||||
if (requested > 0) // create new thread(s)
|
||||
{
|
||||
push_back(new MainThread(0));
|
||||
|
||||
while (size() < requested)
|
||||
@@ -294,3 +298,5 @@ void ThreadPool::wait_for_workers_finished() const {
|
||||
for (Thread* th : *this)
|
||||
th->wait_for_worker_finished();
|
||||
}
|
||||
|
||||
} // namespace Stockfish
|
||||
|
||||
Reference in New Issue
Block a user