How do I choose between Semaphore and SemaphoreSlim?

后端 未结 5 667
余生分开走
余生分开走 2020-12-04 18:41

Their public interfaces appear similar. The documentation states that the SemaphoreSlim is a lightweight alternative and doesn\'t use Windows Kernel semaphores. This resou

5条回答
  •  时光取名叫无心
    2020-12-04 19:06

    The MSDN documentation describes the difference.

    In one sentence:

    • The SemaphoreSlim class represents a lightweight, fast semaphore that can be used for waiting within a single process when wait times are expected to be very short.

提交回复
热议问题