Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#365: FreeBSD Pthread get thread fix #371

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/co/co.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include <time.h> // for clock_gettime
#else
#include <sys/time.h> // for gettimeofday
#ifndef __APPLE__
#include <pthread_np.h> // for getting proper threadid on modern BSDs but not Mac OSX
#endif
#endif
#endif

Expand Down Expand Up @@ -100,7 +103,11 @@ uint32 thread_id() { return syscall(SYS_gettid); }
#else /* for mac, bsd.. */
uint32 thread_id() {
uint64 x;
#ifdef __APPLE__
pthread_threadid_np(0, &x);
#else
x = pthread_getthreadid_np();
#endif
return (uint32)x;
}
#endif
Expand Down