mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-21 01:27:16 +08:00
Refactor Thread class
Associate platform OS thread to the Thread class instead of creating it from ThreadsManager. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -66,6 +66,9 @@ struct SplitPoint {
|
||||
|
||||
struct Thread {
|
||||
|
||||
Thread(int id);
|
||||
~Thread();
|
||||
|
||||
void wake_up();
|
||||
bool cutoff_occurred() const;
|
||||
bool is_available_to(int master) const;
|
||||
@@ -100,7 +103,7 @@ class ThreadsManager {
|
||||
static storage duration are automatically set to zero before enter main()
|
||||
*/
|
||||
public:
|
||||
Thread& operator[](int threadID) { return threads[threadID]; }
|
||||
Thread& operator[](int threadID) { return *threads[threadID]; }
|
||||
void init();
|
||||
void exit();
|
||||
|
||||
@@ -123,7 +126,8 @@ public:
|
||||
private:
|
||||
friend struct Thread;
|
||||
|
||||
Thread threads[MAX_THREADS + 1]; // Last one is used as a timer
|
||||
Thread* timer;
|
||||
Thread* threads[MAX_THREADS];
|
||||
Lock splitLock;
|
||||
WaitCondition sleepCond;
|
||||
Depth minimumSplitDepth;
|
||||
|
||||
Reference in New Issue
Block a user