mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-04-14 14:41:42 +03:00
background_thread: add fallback for pthread_create dlsym
If jemalloc is linked into a shared library, the RTLD_NEXT dlsym call may fail since RTLD_NEXT is only specified to search all objects after the current one in the loading order, and the pthread library may be earlier in the load order. Instead of failing immediately, attempt one more time to find pthread_create via RTLD_GLOBAL. Errors cascading from this were observed on FreeBSD 14.1.
This commit is contained in:
parent
ac279d7e71
commit
86988bb5a8
1 changed files with 3 additions and 0 deletions
|
|
@ -63,6 +63,9 @@ pthread_create_fptr_init(void) {
|
|||
*/
|
||||
#ifdef JEMALLOC_HAVE_DLSYM
|
||||
pthread_create_fptr = dlsym(RTLD_NEXT, "pthread_create");
|
||||
if (pthread_create_fptr == NULL) {
|
||||
pthread_create_fptr = dlsym(RTLD_DEFAULT, "pthread_create");
|
||||
}
|
||||
#else
|
||||
pthread_create_fptr = NULL;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue