| 1246 | } |
| 1247 | |
| 1248 | static bool |
| 1249 | malloc_init_hard_needed(void) { |
| 1250 | if (malloc_initialized() || (IS_INITIALIZER && malloc_init_state == |
| 1251 | malloc_init_recursible)) { |
| 1252 | /* |
| 1253 | * Another thread initialized the allocator before this one |
| 1254 | * acquired init_lock, or this thread is the initializing |
| 1255 | * thread, and it is recursively allocating. |
| 1256 | */ |
| 1257 | return false; |
| 1258 | } |
| 1259 | #ifdef JEMALLOC_THREADED_INIT |
| 1260 | if (malloc_initializer != NO_INITIALIZER && !IS_INITIALIZER) { |
| 1261 | /* Busy-wait until the initializing thread completes. */ |
| 1262 | spin_t spinner = SPIN_INITIALIZER; |
| 1263 | do { |
| 1264 | malloc_mutex_unlock(TSDN_NULL, &init_lock); |
| 1265 | spin_adaptive(&spinner); |
| 1266 | malloc_mutex_lock(TSDN_NULL, &init_lock); |
| 1267 | } while (!malloc_initialized()); |
| 1268 | return false; |
| 1269 | } |
| 1270 | #endif |
| 1271 | return true; |
| 1272 | } |
| 1273 | |
| 1274 | static bool |
| 1275 | malloc_init_hard_a0_locked() { |
no test coverage detected