mirror of https://github.com/fafhrd91/actix-net
Add safety note on `take`
This commit is contained in:
parent
08c16c4597
commit
a63e2de11c
|
|
@ -75,6 +75,8 @@ impl LocalWaker {
|
||||||
/// If a waker has not been registered, this returns `None`.
|
/// If a waker has not been registered, this returns `None`.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn take(&self) -> Option<Waker> {
|
pub fn take(&self) -> Option<Waker> {
|
||||||
|
// SAFETY: This can cause data races if called from a separate thread,
|
||||||
|
// but `LocalWaker` is `!Send` + `!Sync` so this won't happen.
|
||||||
unsafe { (*self.waker.get()).take() }
|
unsafe { (*self.waker.get()).take() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue