File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 35
35
#include < sched.h>
36
36
#include < atomic>
37
37
#include < assert.h>
38
+ #ifdef __FreeBSD__
39
+ #include < pthread_np.h>
40
+ #else
38
41
#include < pthread.h>
42
+ #endif
39
43
#include < limits.h>
40
44
#include < map>
41
45
#ifdef __linux__
@@ -167,7 +171,12 @@ extern "C" pid_t gettid()
167
171
#else
168
172
if (pidCache == -1 ) {
169
173
uint64_t tidT;
174
+ #ifdef __FreeBSD__
175
+ // Check https://github.com/ClickHouse/ClickHouse/commit/8d51824ddcb604b6f179a0216f0d32ba5612bd2e
176
+ tidT = pthread_getthreadid_np ();
177
+ #else
170
178
pthread_threadid_np (nullptr , &tidT);
179
+ #endif
171
180
serverAssert (tidT < UINT_MAX);
172
181
pidCache = (int )tidT;
173
182
}
@@ -493,4 +502,4 @@ void fastlock_auto_adjust_waits()
493
502
#else
494
503
g_fHighCpuPressure = g_fTestMode;
495
504
#endif
496
- }
505
+ }
You can’t perform that action at this time.
0 commit comments