You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In dynamic_worker_threadpool.cc file, i think WaitForNotify() are used to several scenarios like:
1.between push and pop idle_threads_stack, add_task() firstly pop the stack, which make pinfo !=info, and set() before wait(), so thread don't need to wait.
2.pinfo ==info, thread automatically loop for tasks.
3.when pinfo !=info, the set() make another thread wake and continue to work(by condition signal).
So i may have confused by 2 questions:
1.before shutdown(), it seems like each time at least one thread must be active, because each thread always waked from set() which set is_set to true, so when WaitForIdle() could return?
2.Shutdown() set stopped_ to false to make active thread breaking the loop to complete. Why need to maintain the one last thread to wait for event_for_all_workers_exit_ signal? I think that when thread_num_ decrease to zero, event_for_all_workers_exit_ wait() could be return directly.
The text was updated successfully, but these errors were encountered:
In dynamic_worker_threadpool.cc file, i think WaitForNotify() are used to several scenarios like:
1.between push and pop idle_threads_stack, add_task() firstly pop the stack, which make pinfo !=info, and set() before wait(), so thread don't need to wait.
2.pinfo ==info, thread automatically loop for tasks.
3.when pinfo !=info, the set() make another thread wake and continue to work(by condition signal).
So i may have confused by 2 questions:
1.before shutdown(), it seems like each time at least one thread must be active, because each thread always waked from set() which set is_set to true, so when WaitForIdle() could return?
2.Shutdown() set stopped_ to false to make active thread breaking the loop to complete. Why need to maintain the one last thread to wait for event_for_all_workers_exit_ signal? I think that when thread_num_ decrease to zero, event_for_all_workers_exit_ wait() could be return directly.
The text was updated successfully, but these errors were encountered: