thread_self on MACOSX should be handled specially.

This commit is contained in:
zsx 2017-07-17 15:26:30 +08:00
parent b1dfd6bdd3
commit 29ede19711

View File

@ -49,6 +49,10 @@ void* thread::thread_run(void* arg)
thr->thread_id_ = GetCurrentThreadId();
#elif defined(ACL_FREEBSD)
thr->thread_id_ = pthread_getthreadid_np();
#elif defined(ACL_MACOSX)
unsigned long long n;
(void) pthread_threadid_np(NULL, &n);
thr->thread_id_ = (unsigned long) n;
#else
thr->thread_id_ = (unsigned long) pthread_self();
#endif
@ -168,6 +172,10 @@ unsigned long thread::thread_self()
{
#ifdef ACL_FREEBSD
return (unsigned long) pthread_getthreadid_np();
#elif defined(ACL_MACOSX)
unsigned long long n;
(void) pthread_threadid_np(NULL, &n);
return (unsigned long) n;
#else
return (unsigned long) acl_pthread_self();
#endif