X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fthread.h;h=3f3c8c4c0a1614aee6735de0551073ee4c7a358c;hp=12fc4f23a70e1c21d596f092b9b0a35932c0e9b8;hb=699f700162f410519e5510c667aebc9940d4e91e;hpb=673bc5526fa3d352f823ad144fb521b5dc98f45c diff --git a/src/thread.h b/src/thread.h index 12fc4f23..3f3c8c4c 100644 --- a/src/thread.h +++ b/src/thread.h @@ -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 threads; Thread* timer; + ThreadLocalStorageKey tlsKey; Lock splitLock; WaitCondition sleepCond; Depth minimumSplitDepth;