diff options
| author | 袁浩----天命剑主 <yuanhonglong@outlook.com> | 2024-07-16 11:34:23 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-16 11:34:23 +0800 |
| commit | 00fff8ac648d486b777c4345ba589be1f5643c59 (patch) | |
| tree | 2c9d4436b013ef7e70033dc2ae5484de64699580 /library/std/src/sys/sync | |
| parent | 060a40de63f68c44d38710ebc6dc185ccd156053 (diff) | |
clean unsafe op in unsafe fn
Diffstat (limited to 'library/std/src/sys/sync')
| -rw-r--r-- | library/std/src/sys/sync/condvar/teeos.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/library/std/src/sys/sync/condvar/teeos.rs b/library/std/src/sys/sync/condvar/teeos.rs index 0a931f407d2..6457da91c2a 100644 --- a/library/std/src/sys/sync/condvar/teeos.rs +++ b/library/std/src/sys/sync/condvar/teeos.rs @@ -76,16 +76,16 @@ impl Condvar { #[inline] pub unsafe fn wait(&self, mutex: &Mutex) { - let mutex = mutex::raw(mutex); + let mutex = unsafe { mutex::raw(mutex) }; self.verify(mutex); - let r = libc::pthread_cond_wait(raw(self), mutex); + let r = unsafe { libc::pthread_cond_wait(raw(self), mutex) }; debug_assert_eq!(r, 0); } pub unsafe fn wait_timeout(&self, mutex: &Mutex, dur: Duration) -> bool { use crate::sys::time::Timespec; - let mutex = mutex::raw(mutex); + let mutex = unsafe { mutex::raw(mutex) }; self.verify(mutex); let timeout = Timespec::now(libc::CLOCK_MONOTONIC) @@ -93,7 +93,7 @@ impl Condvar { .and_then(|t| t.to_timespec()) .unwrap_or(TIMESPEC_MAX); - let r = pthread_cond_timedwait(raw(self), mutex, &timeout); + let r = unsafe { pthread_cond_timedwait(raw(self), mutex, &timeout) }; assert!(r == libc::ETIMEDOUT || r == 0); r == 0 } |
