tabs ↹ over ␣ ␣ ␣ spaces

by Jiří {x2} Činčura

Asynchronous semaphore

6 Jun 2012 .NET, Multithreading/Parallelism/Asynchronous/Concurrency

I was just checking some documentation around System.Threading namespace for .NET 4.5 and I found that there’s one nice addition to synchronization primitives.

As you might imaging using async/await with synchronization primitives isn’t particularly good idea, because you can easily make a mistake and end up with code that looks correct but produces completely wrong results.

But still, for some primitives it might be useful. The BCL team (or whoever is responsible to this part) decided, the SemaphoreSlim is worth it. The method is SemaphoreSlim.WaitAsync.

Nice. This might nicely play with some legacy threading code.