| 882 | } |
| 883 | |
| 884 | static unsigned |
| 885 | ctl_arena_init(tsd_t *tsd, extent_hooks_t *extent_hooks) { |
| 886 | unsigned arena_ind; |
| 887 | ctl_arena_t *ctl_arena; |
| 888 | |
| 889 | if ((ctl_arena = ql_last(&ctl_arenas->destroyed, destroyed_link)) != |
| 890 | NULL) { |
| 891 | ql_remove(&ctl_arenas->destroyed, ctl_arena, destroyed_link); |
| 892 | arena_ind = ctl_arena->arena_ind; |
| 893 | } else { |
| 894 | arena_ind = ctl_arenas->narenas; |
| 895 | } |
| 896 | |
| 897 | /* Trigger stats allocation. */ |
| 898 | if (arenas_i_impl(tsd, arena_ind, false, true) == NULL) { |
| 899 | return UINT_MAX; |
| 900 | } |
| 901 | |
| 902 | /* Initialize new arena. */ |
| 903 | if (arena_init(tsd_tsdn(tsd), arena_ind, extent_hooks) == NULL) { |
| 904 | return UINT_MAX; |
| 905 | } |
| 906 | |
| 907 | if (arena_ind == ctl_arenas->narenas) { |
| 908 | ctl_arenas->narenas++; |
| 909 | } |
| 910 | |
| 911 | return arena_ind; |
| 912 | } |
| 913 | |
| 914 | static void |
| 915 | ctl_background_thread_stats_read(tsdn_t *tsdn) { |
no test coverage detected