Closed MarkCiliaVincenti closed 5 months ago
I believe that if you want the method to be truly asynchronous then you should not be using the synchronous lock.
I believe that if you want the method to be truly asynchronous then you should not be using the synchronous lock.
It's not always true. In these cases, lock
is used for a few short operations that run on the CPU, so we don't get some valuable benefits (not to mention that SemaphoreSlim
also uses a short lock
under the hood when taking a lock). Also, there is a re-entrance, so with SemaphoreSlim
it highly likely will be broken.
It indeed would, re-entrance and asynchronous code are always a bit of a nightmare.
@MarkCiliaVincenti Thanks a lot for the contributation! I couldn't catch, what is the benefit of
AsyncNonKeyedLocker
under built-inSemaphoreSlim
?I'm just trying to understand, is it really costs to add an extra dependency.