(&self, try_lock: F)
| 32 | |
| 33 | #[inline] |
| 34 | fn lock_internal<F: FnOnce() -> bool>(&self, try_lock: F) -> Option<bool> { |
| 35 | let id = self.get_thread_id.nonzero_thread_id().get(); |
| 36 | if self.owner.load(Ordering::Relaxed) == id { |
| 37 | return None; |
| 38 | } else { |
| 39 | if !try_lock() { |
| 40 | return Some(false); |
| 41 | } |
| 42 | self.owner.store(id, Ordering::Relaxed); |
| 43 | } |
| 44 | Some(true) |
| 45 | } |
| 46 | |
| 47 | /// Blocks for the mutex to be available, and returns true if the mutex isn't already |
| 48 | /// locked on the current thread. |