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