Closed marvin-j97 closed 1 month ago
Hmm, yes, I think that should be doable! You'd just want a variant of
https://github.com/jonhoo/guardian/blob/2460e843a5557df4def9ae8b20a4f3700bd84cce/src/lib.rs#L216
That calls try_lock
and returns an Option
. I'm a bit short on time at the moment, but would be happy to review a PR!
Is it possible for guardian to implement something like
Mutex::try_lock
(try_take?), that doesn't block the thread if it can't take the mutex immediately? I have a situation where I have multiple mutexes that may or may not be blocked, and I want to iterate through them to find an open lock. With guardian that is currently not possible, but it would be nice to get the lifetime-free lock guard.