Skip to content

Commit

Permalink
sys.cpp: update pthread_threadid code for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 committed Feb 2, 2024
1 parent e937341 commit edcd035
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/occa/internal/utils/sys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,13 @@ namespace occa {

int getTID() {
#if (OCCA_OS & (OCCA_LINUX_OS | OCCA_MACOS_OS))
#if OCCA_OS == OCCA_MACOS_OS & (MAC_OS_X_VERSION_MAX_ALLOWED >= 101200)
#if OCCA_OS == OCCA_MACOS_OS & (MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)
uint64_t tid64;
pthread_threadid_np(NULL, &tid64);
pthread_threadid_np(nullptr, &tid64);
pid_t tid = (pid_t)tid64;
#else
pid_t tid = syscall(SYS_gettid);
uint64_t tid;
tid = pthread_mach_thread_np(pthread_self());
#endif
return tid;
#else
Expand Down

0 comments on commit edcd035

Please sign in to comment.