mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
ThreadNumber: added (experimental).
This commit is contained in:
parent
069525a412
commit
fb1e8d8b75
12
libs/libcommon/src/ThreadNumber.cpp
Normal file
12
libs/libcommon/src/ThreadNumber.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include <Yandex/ThreadNumber.h>
|
||||
|
||||
|
||||
__thread unsigned thread_number = 0;
|
||||
unsigned threads = 0;
|
||||
|
||||
unsigned ThreadNumber::get()
|
||||
{
|
||||
if (unlikely(!thread_number))
|
||||
thread_number = __sync_add_and_fetch(&threads, 1);
|
||||
return thread_number;
|
||||
}
|
Loading…
Reference in New Issue
Block a user