How do I choose between Semaphore and SemaphoreSlim?

One difference is that SemaphoreSlim does not permit named semaphores, which can be system-wide. This would mean that a SemaphoreSlim could not be used for cross-process synchronization.

The MSDN documentation also indicates that SemSlim should be used when “wait times are expected to be very short”. That would usually dovetail nicely with the idea that the slim version is more lightweight for most of the trade offs.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)