mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-18 00:00:09 +02:00
Implement Sync for LoopData
It's already Sync because it's safe to access amongst many threads by the sheer fact that data is only accessed on one thread. That is, all other concurrent accessors, if any, will receive `None`.
This commit is contained in:
@@ -783,8 +783,13 @@ mod dropbox {
|
||||
inner: Option<Box<A>>,
|
||||
}
|
||||
|
||||
// We can be sent across threads due to the comment above
|
||||
unsafe impl<A: ?Sized> Send for DropBox<A> {}
|
||||
|
||||
// We can also be shared across threads just fine as we'll only ever get a
|
||||
// reference on at most one thread, regardless of `A`.
|
||||
unsafe impl<A: ?Sized> Sync for DropBox<A> {}
|
||||
|
||||
impl DropBox<Any> {
|
||||
/// Creates a new `DropBox` pinned to the current threads.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user