Crate with_lock[][src]

Expand description

Sometimes, you are using a sync lock like the standard library’s Mutex. You need to use it in some async code, and call the lock method on the Mutex. However, this is prone to deadlocks. This crate provides a wrapper around the Mutex that will never deadlock. (hence the description, Deadlock freedom) It never deadlocks because it has its own function, with_lock, that access’ the Mutex, locks it, performs the closure, and then drops the lock. Enjoy deadlock free code!

Structs