DirtyHairy/async-mutex

Possible to have blocking version of isLocked?

JasonGore opened this issue · 0 comments

I have my own simple mutex implementation I've been using, but was looking at adopting this library because of the isLocked function. (I also like the amount of test coverage you have.) I'm curious if it's realistic or possible to have an async version of isLocked that blocks until the lock is available, like a waitForUnlock function.

I know there are some inconsistencies with checking for a locked state without actually locking it, but I think they would already apply to isLocked. I have some actions that don't need to lock an exclusive resource, but should not run if the exclusive resource is already in use. In effect, these functions depend on exclusive resource output and should wait if it's in use.