ThreadNumber: added (experimental).

This commit is contained in:
Alexey Milovidov 2010-12-20 18:50:34 +00:00
parent 069525a412
commit fb1e8d8b75

View 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;
}