I was reading this question and at the time of writing, there were two async locking primitives that were widely used in C#; AsyncLock from the AsyncEx library, and Scott Hanselman's AsyncLock (based on Stephen Toub's AsyncLock). Neither are officially supported by Microsoft, and for something as fundamental as synchronization primitives I'd really prefer to use a lock that's actually in the .NET SDK/framework and which is official.
Has Microsoft yet introduced anything official to this extent? ie. an async equivalent to a lock block? If not, are there any plans to do so? It seems like a rather large oversight. I know you can use SemaphoreSlim to achieve an async mutex, but it's still not a proper locking class.
Proper locking class: a class that provides an IDisposable releaser, so that it can be used with the using statement.
No. Currently there is a movement towards a new
Locktype, that is intended as an alternative for thelockstatement. AFAIK there is nothing going on in the C# language or the .NET runtime, about anawait lockstatement or anAsyncLocktype.