be notified when all background threadpool threads are finished

后端 未结 7 1919
星月不相逢
星月不相逢 2020-12-16 01:37

I have a scenario when I start 3..10 threads with ThreadPool. Each thread does its job and returns to the ThreadPool. What are possible options to be notified in main thread

7条回答
  •  庸人自扰
    2020-12-16 02:14

    Couldn't you give each thread a distinct ManualResetEvent and have each set the event when done. Then, in the main thread you can wait on all the events passed in.

提交回复
热议问题