Blocks for the mutex to be available, and returns true if the mutex isn't already locked on the current thread.
(&self)
| 47 | /// Blocks for the mutex to be available, and returns true if the mutex isn't already |
| 48 | /// locked on the current thread. |
| 49 | pub fn lock(&self) -> bool { |
| 50 | self.lock_internal(|| { |
| 51 | self.mutex.lock(); |
| 52 | true |
| 53 | }) |
| 54 | .is_some() |
| 55 | } |
| 56 | |
| 57 | /// Like `lock()` but wraps the blocking wait in `wrap_fn`. |
| 58 | /// The caller can use this to detach thread state while waiting. |
no test coverage detected