From 8d51824ddcb604b6f179a0216f0d32ba5612bd2e Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Fri, 28 Feb 2020 14:24:56 +0300 Subject: [PATCH] getThreadId for FreeBSD --- base/common/getThreadId.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/base/common/getThreadId.cpp b/base/common/getThreadId.cpp index f35d85f23ed..2542b14acf1 100644 --- a/base/common/getThreadId.cpp +++ b/base/common/getThreadId.cpp @@ -3,6 +3,8 @@ #if OS_LINUX #include #include +#elif OS_FREEBSD + #include #else #include #include @@ -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");