3 ms·
Hardest part was synchronization - to end the main thread only if all tasks are done - when every running task can produce multiple new tasks - with limiting
by janci 10y ago
Hardest part was synchronization
- to end the main thread only if all tasks are done
- when every running task can produce multiple new tasks
- with limiting the maximum number of running threads
- always running the maximum nubmer of threads if possible
semaphores to the rescue
- tokenizerrr 10y agoDoesn't ThreadPoolExecutor take care of all of that if you store the returned Future from the submit method? Then you just have the main thread wait for those.