From d2bb8e01fd8e94ace63652cd7e72babd4b1cf11b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 5 Aug 2016 14:01:36 -0700 Subject: [PATCH] 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`. --- src/event_loop.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/event_loop.rs b/src/event_loop.rs index 37ae53a05..68bc18c35 100644 --- a/src/event_loop.rs +++ b/src/event_loop.rs @@ -783,8 +783,13 @@ mod dropbox { inner: Option>, } + // We can be sent across threads due to the comment above unsafe impl Send for DropBox {} + // 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 Sync for DropBox {} + impl DropBox { /// Creates a new `DropBox` pinned to the current threads. ///