We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0dbf5a6 commit aba502bCopy full SHA for aba502b
examples/mutex.rs
@@ -123,19 +123,19 @@ impl<T> Mutex<T> {
123
}
124
125
126
+/// A guard holding a lock.
127
+struct MutexGuard<'a, T>(&'a Mutex<T>);
128
+
129
+unsafe impl<T: Send> Send for MutexGuard<'_, T> {}
130
+unsafe impl<T: Sync> Sync for MutexGuard<'_, T> {}
131
132
impl<T> Drop for MutexGuard<'_, T> {
133
fn drop(&mut self) {
134
self.0.locked.store(false, Ordering::Release);
135
self.0.lock_ops.notify(1);
136
137
138
-/// A guard holding a lock.
-struct MutexGuard<'a, T>(&'a Mutex<T>);
-
-unsafe impl<T: Send> Send for MutexGuard<'_, T> {}
-unsafe impl<T: Sync> Sync for MutexGuard<'_, T> {}
139
impl<T> Deref for MutexGuard<'_, T> {
140
type Target = T;
141
0 commit comments