I have been trying to do this:
Create \'N\' Task to execute and keep running this number of taks for a period of time, in that case the one task finalize, then i sho
This code will keep running numTasks Tasks in parallel.
numTasks
int numTasks = 5; SemaphoreSlim semaphore = new SemaphoreSlim(numTasks); while(true) { semaphore.Wait(); Task.Run(() => { DoSomething(); }) .ContinueWith(_ => semaphore.Release()); }