mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
getThreadId for FreeBSD
This commit is contained in:
parent
adf4f7349f
commit
8d51824ddc
@ -3,6 +3,8 @@
|
||||
#if OS_LINUX
|
||||
#include <unistd.h>
|
||||
#include <syscall.h>
|
||||
#elif OS_FREEBSD
|
||||
#include <pthread_np.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include <stdexcept>
|
||||
@ -16,6 +18,8 @@ uint64_t getThreadId()
|
||||
{
|
||||
#if OS_LINUX
|
||||
current_tid = syscall(SYS_gettid); /// This call is always successful. - man gettid
|
||||
#elif OS_FREEBSD
|
||||
current_tid = pthread_getthreadid_np();
|
||||
#else
|
||||
if (0 != pthread_threadid_np(nullptr, ¤t_tid))
|
||||
throw std::logic_error("pthread_threadid_np returned error");
|
||||
|
Loading…
Reference in New Issue
Block a user