Do semaphores prevent instruction reordering?

前端 未结 3 1459
栀梦
栀梦 2021-01-13 05:00

I was looking for an awaitable equivalent of lock statements in C#. Some people suggest using a binary SemaphoreSlim in the following way:

await         


        
3条回答
  •  一整个雨季
    2021-01-13 05:23

    The SemaphoreSlim guarantee is kind of implicit. It's described as a locking synchronization primitive in Overview of Synchronization Primitives.

提交回复
热议问题