Remove unsound SendSyncWrapper (#3303)
This commit is contained in:
parent
ba654bb61e
commit
34e42ff94d
12 changed files with 86 additions and 79 deletions
15
src/lib.rs
15
src/lib.rs
|
|
@ -173,18 +173,3 @@ mod platform_impl;
|
|||
pub mod window;
|
||||
|
||||
pub mod platform;
|
||||
|
||||
/// Wrapper for objects which winit will access on the main thread so they are effectively `Send`
|
||||
/// and `Sync`, since they always execute on a single thread.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// Winit can run only one event loop at a time, and the event loop itself is tied to some thread.
|
||||
/// The objects could be sent across the threads, but once passed to winit, they execute on the
|
||||
/// main thread if the platform demands it. Thus, marking such objects as `Send + Sync` is safe.
|
||||
#[doc(hidden)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct SendSyncWrapper<T>(pub(crate) T);
|
||||
|
||||
unsafe impl<T> Send for SendSyncWrapper<T> {}
|
||||
unsafe impl<T> Sync for SendSyncWrapper<T> {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue