From 76a59fd6e2d5c8c42193c047fd5eaba982d499f7 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Thu, 13 Feb 2014 17:17:50 +1100 Subject: std: add an RAII unlocker to Mutex. This automatically unlocks its lock when it goes out of scope, and provides a safe(ish) method to call .wait. --- src/libsync/sync/mutex.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libsync/sync') diff --git a/src/libsync/sync/mutex.rs b/src/libsync/sync/mutex.rs index 3726528a5e9..f5914b26e85 100644 --- a/src/libsync/sync/mutex.rs +++ b/src/libsync/sync/mutex.rs @@ -288,11 +288,11 @@ impl StaticMutex { // `lock()` function on an OS mutex fn native_lock(&mut self, t: ~Task) { Local::put(t); - unsafe { self.lock.lock(); } + unsafe { self.lock.lock_noguard(); } } fn native_unlock(&mut self) { - unsafe { self.lock.unlock(); } + unsafe { self.lock.unlock_noguard(); } } fn green_lock(&mut self, t: ~Task) { -- cgit 1.4.1-3-g733a5