mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-04-24 20:02:14 +03:00
Detect pthread_getname_np explicitly.
At least one libc (musl) defines pthread_setname_np without defining pthread_getname_np. Detect the presence of each individually, rather than inferring both must be defined if set is.
This commit is contained in:
parent
b3c5690b7e
commit
95f0a77fde
3 changed files with 41 additions and 1 deletions
|
|
@ -292,8 +292,11 @@ void prof_unwind_init() {
|
|||
|
||||
static int
|
||||
prof_sys_thread_name_read_impl(char *buf, size_t limit) {
|
||||
#ifdef JEMALLOC_HAVE_PTHREAD_SETNAME_NP
|
||||
#if defined(JEMALLOC_HAVE_PTHREAD_GETNAME_NP)
|
||||
return pthread_getname_np(pthread_self(), buf, limit);
|
||||
#elif defined(JEMALLOC_HAVE_PTHREAD_GET_NAME_NP)
|
||||
pthread_get_name_np(pthread_self(), buf, limit);
|
||||
return 0;
|
||||
#else
|
||||
return ENOSYS;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue