mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 16:35:45 +08:00
use pthread_getthrds_np for AIX
This commit is contained in:
parent
aac187d3a0
commit
232df72b82
@ -46,7 +46,7 @@
|
|||||||
# include <sys/syscall.h> //Use gettid() syscall under linux to get thread id
|
# include <sys/syscall.h> //Use gettid() syscall under linux to get thread id
|
||||||
|
|
||||||
# elif defined(_AIX)
|
# elif defined(_AIX)
|
||||||
# include <pthread.h> // for pthread_getthreadid_np
|
# include <pthread.h> // for pthread_getthrds_np
|
||||||
|
|
||||||
# elif defined(__DragonFly__) || defined(__FreeBSD__)
|
# elif defined(__DragonFly__) || defined(__FreeBSD__)
|
||||||
# include <pthread_np.h> // for pthread_getthreadid_np
|
# include <pthread_np.h> // for pthread_getthreadid_np
|
||||||
@ -337,7 +337,12 @@ SPDLOG_INLINE size_t _thread_id() SPDLOG_NOEXCEPT
|
|||||||
# endif
|
# endif
|
||||||
return static_cast<size_t>(::syscall(SYS_gettid));
|
return static_cast<size_t>(::syscall(SYS_gettid));
|
||||||
#elif defined(_AIX)
|
#elif defined(_AIX)
|
||||||
return static_cast<size_t>(::pthread_self());
|
struct __pthrdsinfo buf;
|
||||||
|
int reg_size = 0;
|
||||||
|
pthread_t pt = pthread_self();
|
||||||
|
int retval = pthread_getthrds_np(&pt, PTHRDSINFO_QUERY_TID, &buf, sizeof(buf), NULL, ®_size);
|
||||||
|
int tid = (!retval) ? buf.__pi_tid : 0;
|
||||||
|
return static_cast<size_t>(tid);
|
||||||
#elif defined(__DragonFly__) || defined(__FreeBSD__)
|
#elif defined(__DragonFly__) || defined(__FreeBSD__)
|
||||||
return static_cast<size_t>(::pthread_getthreadid_np());
|
return static_cast<size_t>(::pthread_getthreadid_np());
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
|
Loading…
Reference in New Issue
Block a user