Skip to content

Test code for NeoSmart.AsyncLock() may be showcasing _correct_ behavior. #6

@Nerketur

Description

@Nerketur

* [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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions