We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fbd158b commit 417c5aeCopy full SHA for 417c5ae
crnlib/crn_threading_pthreads.cpp
@@ -32,9 +32,15 @@ void crn_threading_init() {
32
#endif
33
}
34
35
-crn_thread_id_t crn_get_current_thread_id() {
36
- // FIXME: Not portable
37
- return static_cast<crn_thread_id_t>(pthread_self());
+crn_thread_id_t crn_get_current_thread_id()
+{
+#if defined(CRN_OS_BSD4) || defined(CRN_OS_DARWIN)
38
+ crn_thread_id_t id;
39
+ pthread_threadid_np(pthread_self(), &id);
40
+ return id;
41
+#else
42
+ return static_cast<crn_thread_id_t>(pthread_self());
43
+#endif
44
45
46
void crn_sleep(unsigned int milliseconds) {
0 commit comments