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:
Alex Crichton
2016-08-05 14:01:36 -07:00
parent 5b18514970
commit d2bb8e01fd
+5
View File
@@ -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.
///