-
Notifications
You must be signed in to change notification settings - Fork 0
Description
cs-reentrant-async-lock/README.md
Line 56 in 50d2632
| * [NeoSmart.AsyncLock](https://github.com/neosmart/AsyncLock) does not provide reentrance with mutual exclusion: https://dotnetfiddle.net/CkK674 |
I'll admit I'm not a master of async code, but isn't the code, as written guaranteed to deadlock? Sending code off to a Task.Run() will create a new thread, so "reentry" isn't valid anymore. In that way, I think AsyncLock performs correctly by returning Deadlock? here, because the "reentrant" code is on a different thread (and thus will be blocked from entering).
Of course, this does also mean all the other ones claimed incorrect are indeed incorrect, it's only this one I'm not convinced is actually wrong. It might be the only one to be actually right.
If Task.Run() does not run things in a new thread, then I'm wrong and will fully own up to my mistake.