Use _lwp_self() in THREADSilentGetCurrentThreadId() for NetBSD
authorKamil Rytarowski <n54@gmx.com>
Tue, 12 Apr 2016 00:26:54 +0000 (02:26 +0200)
committerKamil Rytarowski <n54@gmx.com>
Tue, 12 Apr 2016 00:26:54 +0000 (02:26 +0200)
The _lwp_self() call returns the LWP ID of the calling LWP.
It requires <lwp.h> on NetBSD.

src/pal/src/include/pal/thread.hpp

index 524c552..e6dacd2 100644 (file)
@@ -828,6 +828,9 @@ inline SIZE_T THREADSilentGetCurrentThreadId() {
     pthread_threadid_np(pthread_self(), &tid);
     return (SIZE_T)tid;
 }
+#elif defined(__NetBSD__)
+#include <lwp.h>
+#define THREADSilentGetCurrentThreadId() (SIZE_T)_lwp_self()
 #else
 #define THREADSilentGetCurrentThreadId() (SIZE_T)pthread_self()
 #endif