mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 17:16:33 +08:00
Use thread_local compiler specifics
Much faster then pthread_getspecific() but still a speed regression against the original code. Following are the nps on a bench: Position 454165 454838 455433 tls 441046 442767 442767 ms (Win) 450521 447510 451105 ms (pthread) 422115 422115 424276 Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -120,8 +120,6 @@ public:
|
||||
int min_split_depth() const { return minimumSplitDepth; }
|
||||
int size() const { return (int)threads.size(); }
|
||||
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;
|
||||
@@ -140,7 +138,6 @@ private:
|
||||
|
||||
std::vector<Thread*> threads;
|
||||
Thread* timer;
|
||||
ThreadLocalStorageKey tlsKey;
|
||||
Lock splitLock;
|
||||
WaitCondition sleepCond;
|
||||
Depth minimumSplitDepth;
|
||||
@@ -149,5 +146,6 @@ private:
|
||||
};
|
||||
|
||||
extern ThreadsManager Threads;
|
||||
extern THREAD_LOCAL Thread* this_thread;
|
||||
|
||||
#endif // !defined(THREAD_H_INCLUDED)
|
||||
|
||||
Reference in New Issue
Block a user