mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-26 12:06:22 +08:00
Allow execution of tasks on the global thread pool.
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
#include "material.h"
|
||||
#include "movepick.h"
|
||||
@@ -50,10 +51,12 @@ public:
|
||||
explicit Thread(size_t);
|
||||
virtual ~Thread();
|
||||
virtual void search();
|
||||
virtual void execute_task(std::function<void(Thread&)> t);
|
||||
void clear();
|
||||
void idle_loop();
|
||||
void start_searching();
|
||||
void wait_for_search_finished();
|
||||
size_t thread_idx() const { return idx; }
|
||||
|
||||
Pawns::Table pawnsTable;
|
||||
Material::Table materialTable;
|
||||
@@ -78,6 +81,7 @@ public:
|
||||
bool UseRule50;
|
||||
Depth ProbeDepth;
|
||||
|
||||
std::function<void(Thread&)> task;
|
||||
};
|
||||
|
||||
|
||||
@@ -105,6 +109,8 @@ struct MainThread : public Thread {
|
||||
|
||||
struct ThreadPool : public std::vector<Thread*> {
|
||||
|
||||
void execute_parallel(std::function<void(Thread&)> task);
|
||||
|
||||
void start_thinking(Position&, StateListPtr&, const Search::LimitsType&, bool = false);
|
||||
void clear();
|
||||
void set(size_t);
|
||||
|
||||
Reference in New Issue
Block a user