| 571 | } |
| 572 | |
| 573 | bool |
| 574 | background_threads_disable(tsd_t *tsd) { |
| 575 | assert(!background_thread_enabled()); |
| 576 | malloc_mutex_assert_owner(tsd_tsdn(tsd), &background_thread_lock); |
| 577 | |
| 578 | /* Thread 0 will be responsible for terminating other threads. */ |
| 579 | if (background_threads_disable_single(tsd, |
| 580 | &background_thread_info[0])) { |
| 581 | return true; |
| 582 | } |
| 583 | assert(n_background_threads == 0); |
| 584 | unsigned narenas = narenas_total_get(); |
| 585 | for (unsigned i = 0; i < narenas; i++) { |
| 586 | arena_t *arena = arena_get(tsd_tsdn(tsd), i, false); |
| 587 | if (arena != NULL) { |
| 588 | pa_shard_set_deferral_allowed(tsd_tsdn(tsd), |
| 589 | &arena->pa_shard, false); |
| 590 | } |
| 591 | } |
| 592 | |
| 593 | return false; |
| 594 | } |
| 595 | |
| 596 | bool |
| 597 | background_thread_is_started(background_thread_info_t *info) { |
no test coverage detected