| 711 | #endif |
| 712 | |
| 713 | static bool |
| 714 | pthread_create_fptr_init(void) { |
| 715 | if (pthread_create_fptr != NULL) { |
| 716 | return false; |
| 717 | } |
| 718 | /* |
| 719 | * Try the next symbol first, because 1) when use lazy_lock we have a |
| 720 | * wrapper for pthread_create; and 2) application may define its own |
| 721 | * wrapper as well (and can call malloc within the wrapper). |
| 722 | */ |
| 723 | #ifdef JEMALLOC_HAVE_DLSYM |
| 724 | pthread_create_fptr = dlsym(RTLD_NEXT, "pthread_create"); |
| 725 | #else |
| 726 | pthread_create_fptr = NULL; |
| 727 | #endif |
| 728 | if (pthread_create_fptr == NULL) { |
| 729 | if (config_lazy_lock) { |
| 730 | malloc_write("<jemalloc>: Error in dlsym(RTLD_NEXT, " |
| 731 | "\"pthread_create\")\n"); |
| 732 | abort(); |
| 733 | } else { |
| 734 | /* Fall back to the default symbol. */ |
| 735 | pthread_create_fptr = pthread_create; |
| 736 | } |
| 737 | } |
| 738 | |
| 739 | return false; |
| 740 | } |
| 741 | |
| 742 | /* |
| 743 | * When lazy lock is enabled, we need to make sure setting isthreaded before |
no test coverage detected