void sgen_workers_stop_all_workers (void) { forced_stop = TRUE; sgen_thread_pool_wait_for_all_jobs (); sgen_thread_pool_idle_wait (); SGEN_ASSERT (0, workers_state == STATE_NOT_WORKING, "Can only signal enqueue work when in no work state"); }
void sgen_workers_wait_for_jobs_finished (void) { sgen_thread_pool_wait_for_all_jobs (); /* * If the idle task was never triggered or it finished before the last job did and * then didn't get triggered again, we might end up in the situation of having * something in the gray queue yet the idle task not working. The easiest way to * make sure this doesn't stay that way is to just trigger it again after all jobs * have finished. */ sgen_workers_ensure_awake (); }
void sgen_workers_join (void) { int i; sgen_thread_pool_wait_for_all_jobs (); sgen_thread_pool_idle_wait (); SGEN_ASSERT (0, workers_state == STATE_NOT_WORKING, "Can only signal enqueue work when in no work state"); /* At this point all the workers have stopped. */ SGEN_ASSERT (0, sgen_section_gray_queue_is_empty (&workers_distribute_gray_queue), "Why is there still work left to do?"); for (i = 0; i < workers_num; ++i) SGEN_ASSERT (0, sgen_gray_object_queue_is_empty (&workers_data [i].private_gray_queue), "Why is there still work left to do?"); }