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.
int numTasks = 5;
SemaphoreSlim semaphore = new SemaphoreSlim(numTasks);
while(true)
{
semaphore.Wait();
Task.Run(() =>
{
DoSomething();
})
.ContinueWith(_ => semaphore.Release());
}
Task scheduler could be used to run an executable that you could use to perform a set of work/tasks. Alternatively, you could simply create a windows service...