| 480 | } |
| 481 | |
| 482 | static void |
| 483 | background_work(tsd_t *tsd, unsigned ind) { |
| 484 | background_thread_info_t *info = &background_thread_info[ind]; |
| 485 | |
| 486 | malloc_mutex_lock(tsd_tsdn(tsd), &info->mtx); |
| 487 | background_thread_wakeup_time_set(tsd_tsdn(tsd), info, |
| 488 | BACKGROUND_THREAD_INDEFINITE_SLEEP); |
| 489 | if (ind == 0) { |
| 490 | background_thread0_work(tsd); |
| 491 | } else { |
| 492 | while (info->state != background_thread_stopped) { |
| 493 | if (background_thread_pause_check(tsd_tsdn(tsd), |
| 494 | info)) { |
| 495 | continue; |
| 496 | } |
| 497 | background_work_sleep_once(tsd_tsdn(tsd), info, ind); |
| 498 | } |
| 499 | } |
| 500 | assert(info->state == background_thread_stopped); |
| 501 | background_thread_wakeup_time_set(tsd_tsdn(tsd), info, 0); |
| 502 | malloc_mutex_unlock(tsd_tsdn(tsd), &info->mtx); |
| 503 | } |
| 504 | |
| 505 | static void * |
| 506 | background_thread_entry(void *ind_arg) { |
no test coverage detected