Remove unsound SendSyncWrapper (#3303)

This commit is contained in:
daxpedda 2023-12-26 20:13:02 +01:00 committed by GitHub
parent ba654bb61e
commit 34e42ff94d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 86 additions and 79 deletions

View file

@ -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> {}