| 1192 | } |
| 1193 | |
| 1194 | static bool |
| 1195 | malloc_init_hard_needed(void) { |
| 1196 | if (malloc_initialized() || (IS_INITIALIZER && malloc_init_state == |
| 1197 | malloc_init_recursible)) { |
| 1198 | /* |
| 1199 | * Another thread initialized the allocator before this one |
| 1200 | * acquired init_lock, or this thread is the initializing |
| 1201 | * thread, and it is recursively allocating. |
| 1202 | */ |
| 1203 | return false; |
| 1204 | } |
| 1205 | #ifdef JEMALLOC_THREADED_INIT |
| 1206 | if (malloc_initializer != NO_INITIALIZER && !IS_INITIALIZER) { |
| 1207 | /* Busy-wait until the initializing thread completes. */ |
| 1208 | spin_t spinner = SPIN_INITIALIZER; |
| 1209 | do { |
| 1210 | malloc_mutex_unlock(TSDN_NULL, &init_lock); |
| 1211 | spin_adaptive(&spinner); |
| 1212 | malloc_mutex_lock(TSDN_NULL, &init_lock); |
| 1213 | } while (!malloc_initialized()); |
| 1214 | return false; |
| 1215 | } |
| 1216 | #endif |
| 1217 | return true; |
| 1218 | } |
| 1219 | |
| 1220 | static bool |
| 1221 | malloc_init_hard_a0_locked() { |
no test coverage detected