Does SemaphoreSlim act as a gatekeeper or as a batchkeeper?
For example: assuming I have semaphore = new SemaphoreSlim(50, 50);
, and suppose I have to perform 1000 tasks.
Does the semaphore.Wait();
or semaphore.WaitAsync();
ensure that 50 tasks are processed as a batch - for example - perform 50 tasks, and when all 50 are complete then do the next 50, and so on..
Or does it act like gatekeeper - for example - perform 50 tasks, then as soon as even 1 task is complete, perform the 51st task, and so on?