diff options
Diffstat (limited to 'src/libstd/sys/unix/mutex.rs')
| -rw-r--r-- | src/libstd/sys/unix/mutex.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libstd/sys/unix/mutex.rs b/src/libstd/sys/unix/mutex.rs index b43af8fdcaa..b38375a2e03 100644 --- a/src/libstd/sys/unix/mutex.rs +++ b/src/libstd/sys/unix/mutex.rs @@ -1,7 +1,9 @@ use crate::cell::UnsafeCell; use crate::mem::MaybeUninit; -pub struct Mutex { inner: UnsafeCell<libc::pthread_mutex_t> } +pub struct Mutex { + inner: UnsafeCell<libc::pthread_mutex_t>, +} #[inline] pub unsafe fn raw(m: &Mutex) -> *mut libc::pthread_mutex_t { @@ -82,7 +84,9 @@ impl Mutex { } } -pub struct ReentrantMutex { inner: UnsafeCell<libc::pthread_mutex_t> } +pub struct ReentrantMutex { + inner: UnsafeCell<libc::pthread_mutex_t>, +} unsafe impl Send for ReentrantMutex {} unsafe impl Sync for ReentrantMutex {} @@ -96,8 +100,8 @@ impl ReentrantMutex { let mut attr = MaybeUninit::<libc::pthread_mutexattr_t>::uninit(); let result = libc::pthread_mutexattr_init(attr.as_mut_ptr()); debug_assert_eq!(result, 0); - let result = libc::pthread_mutexattr_settype(attr.as_mut_ptr(), - libc::PTHREAD_MUTEX_RECURSIVE); + let result = + libc::pthread_mutexattr_settype(attr.as_mut_ptr(), libc::PTHREAD_MUTEX_RECURSIVE); debug_assert_eq!(result, 0); let result = libc::pthread_mutex_init(self.inner.get(), attr.as_ptr()); debug_assert_eq!(result, 0); |
