File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -291,14 +291,19 @@ class SampleHeap : public SuperHeap {
291
291
if (_pythonCount == 0 ) {
292
292
_pythonCount = 1 ; // prevent 0/0
293
293
}
294
+ // Get the thread ID, which must match the logic used by Python.
294
295
uint64_t thread_id;
295
- #if defined(__APPLE__)
296
- // Use OS X / BSD thread identifier function to get "actual" thread ID.
296
+ #if defined(__APPLE__) || defined(BSD)
297
+ // Use the OS X / BSD thread identifier function to get "actual" thread ID.
297
298
pthread_threadid_np (pthread_self (), &thread_id);
299
+ #elif defined(__linux__)
300
+ // On Linux, use gettid().
301
+ thread_id = (uint64_t ) gettid ();
298
302
#else
299
- // On Linux, we cast pthread_self and hope for the best.
303
+ // On other systems, cast pthread_self and hope for the best.
300
304
thread_id = (uint64_t ) pthread_self ();
301
305
#endif
306
+
302
307
snprintf_ (
303
308
buf, sizeof (buf),
304
309
#if defined(__APPLE__)
You can’t perform that action at this time.
0 commit comments