C
C#3mo ago
Core

SemaphoreSlim wait without creating a critical section

Hello, I don't want to have a critical section, instead I should have a section where all threads are blocked until the semaphore is released. When it is released, all threads should start executing the section. For this semaphore.Wait() is not good, because threads will execute the section one by one. The outcome should be: No critical section, just blocking for all threads. Probably some other object is needed for this use case, but what is that?
2 Replies
ACiDCA7
ACiDCA73mo ago
sounds like readerwriterlock would be the better choice then
333fred
333fred3mo ago
Sounds like you want a barrier, not a semaphore

Did you find this page helpful?