diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2014-02-13 17:17:50 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2014-02-16 10:13:56 +1100 |
| commit | 76a59fd6e2d5c8c42193c047fd5eaba982d499f7 (patch) | |
| tree | a913c967de98b492f47fdd0bbd5a11cf0be96ed5 /src/libsync/sync | |
| parent | fba32ea79f1828ef441d91abca3635fad57f323d (diff) | |
| download | rust-76a59fd6e2d5c8c42193c047fd5eaba982d499f7.tar.gz rust-76a59fd6e2d5c8c42193c047fd5eaba982d499f7.zip | |
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.
Diffstat (limited to 'src/libsync/sync')
| -rw-r--r-- | src/libsync/sync/mutex.rs | 4 |
1 files changed, 2 insertions, 2 deletions
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) { |
