I am still fairly new to parallel computing so I am not too sure which tool to use for the job.
I have a System.Threading.Tasks.Task
that needs to wait for n number number of tasks to finish before starting. The tricky part is some of its dependencies may start after this task starts (You are guaranteed to never hit 0 dependent tasks until they are all done).
Here is kind of what is happening
- Parent thread creates somewhere between 1 and (NUMBER_OF_CPU_CORES - 1) tasks.
- Parent thread creates task to be run when all of the worker tasks are finished.
- Parent thread creates a monitoring thread
- Monitoring thread may kill a worker task or spawn a new task depending on load.
I can figure out everything up to step 4. How do I get the task from step 2 to wait to run until any new worker threads created in step 4 finish?