Create a new arena and insert it into the arenas array at index ind. */
| 315 | |
| 316 | /* Create a new arena and insert it into the arenas array at index ind. */ |
| 317 | static arena_t * |
| 318 | arena_init_locked(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks) { |
| 319 | arena_t *arena; |
| 320 | |
| 321 | assert(ind <= narenas_total_get()); |
| 322 | if (ind >= MALLOCX_ARENA_LIMIT) { |
| 323 | return NULL; |
| 324 | } |
| 325 | if (ind == narenas_total_get()) { |
| 326 | narenas_total_inc(); |
| 327 | } |
| 328 | |
| 329 | /* |
| 330 | * Another thread may have already initialized arenas[ind] if it's an |
| 331 | * auto arena. |
| 332 | */ |
| 333 | arena = arena_get(tsdn, ind, false); |
| 334 | if (arena != NULL) { |
| 335 | assert(arena_is_auto(arena)); |
| 336 | return arena; |
| 337 | } |
| 338 | |
| 339 | /* Actually initialize the arena. */ |
| 340 | arena = arena_new(tsdn, ind, extent_hooks); |
| 341 | |
| 342 | return arena; |
| 343 | } |
| 344 | |
| 345 | static void |
| 346 | arena_new_create_background_thread(tsdn_t *tsdn, unsigned ind) { |
no test coverage detected