| 759 | } |
| 760 | |
| 761 | void |
| 762 | background_thread_postfork_child(tsdn_t *tsdn) { |
| 763 | for (unsigned i = 0; i < max_background_threads; i++) { |
| 764 | malloc_mutex_postfork_child(tsdn, |
| 765 | &background_thread_info[i].mtx); |
| 766 | } |
| 767 | malloc_mutex_postfork_child(tsdn, &background_thread_lock); |
| 768 | if (!background_thread_enabled_at_fork) { |
| 769 | return; |
| 770 | } |
| 771 | |
| 772 | /* Clear background_thread state (reset to disabled for child). */ |
| 773 | malloc_mutex_lock(tsdn, &background_thread_lock); |
| 774 | n_background_threads = 0; |
| 775 | background_thread_enabled_set(tsdn, false); |
| 776 | for (unsigned i = 0; i < max_background_threads; i++) { |
| 777 | background_thread_info_t *info = &background_thread_info[i]; |
| 778 | malloc_mutex_lock(tsdn, &info->mtx); |
| 779 | info->state = background_thread_stopped; |
| 780 | int ret = pthread_cond_init(&info->cond, NULL); |
| 781 | assert(ret == 0); |
| 782 | background_thread_info_init(tsdn, info); |
| 783 | malloc_mutex_unlock(tsdn, &info->mtx); |
| 784 | } |
| 785 | malloc_mutex_unlock(tsdn, &background_thread_lock); |
| 786 | } |
| 787 | |
| 788 | bool |
| 789 | background_thread_stats_read(tsdn_t *tsdn, background_thread_stats_t *stats) { |
no test coverage detected