mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 17:16:33 +08:00
Introduce thread local storage
Use thread local storage to store a pointer to the thread we are running on. This will allow to remove thread info from Position class. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -119,7 +119,9 @@ public:
|
||||
bool use_sleeping_threads() const { return useSleepingThreads; }
|
||||
int min_split_depth() const { return minimumSplitDepth; }
|
||||
int size() const { return (int)threads.size(); }
|
||||
Thread* main_thread() { return threads[0]; }
|
||||
Thread* main_thread() const { return threads[0]; }
|
||||
Thread* this_thread() const { return (Thread*)tls_get(tlsKey); }
|
||||
void set_this_thread(Thread* th) const { tls_set(tlsKey, th); }
|
||||
|
||||
void wake_up() const;
|
||||
void sleep() const;
|
||||
@@ -138,6 +140,7 @@ private:
|
||||
|
||||
std::vector<Thread*> threads;
|
||||
Thread* timer;
|
||||
ThreadLocalStorageKey tlsKey;
|
||||
Lock splitLock;
|
||||
WaitCondition sleepCond;
|
||||
Depth minimumSplitDepth;
|
||||
|
||||
Reference in New Issue
Block a user