mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 15:13:13 -04:00
macOS/iOS: Fix auto trait impls of EventLoopProxy (#1084)
* macOS/iOS: Fix auto trait impls of `EventLoopProxy` `EventLoopProxy<T>` allows sending `T` from an arbitrary thread that owns the proxy object. Thus, if `T` is `!Send`, `EventLoopProxy<T>` must not be allowed to leave the main thread. `EventLoopProxy<T>` uses `std::sync::mpsc::Sender` under the hood, meaning the `!Sync` restriction of it also applies to `EventLoopProxy<T>`. That is, even if `T` is thread-safe, a single `EventLoopProxy` object cannot be shared between threads. * Update `CHANGELOG.md`
This commit is contained in:
@@ -142,8 +142,7 @@ pub struct EventLoopProxy<T> {
|
||||
source: CFRunLoopSourceRef,
|
||||
}
|
||||
|
||||
unsafe impl<T> Send for EventLoopProxy<T> {}
|
||||
unsafe impl<T> Sync for EventLoopProxy<T> {}
|
||||
unsafe impl<T: Send> Send for EventLoopProxy<T> {}
|
||||
|
||||
impl<T> Clone for EventLoopProxy<T> {
|
||||
fn clone(&self) -> EventLoopProxy<T> {
|
||||
|
||||
@@ -113,8 +113,7 @@ pub struct Proxy<T> {
|
||||
source: CFRunLoopSourceRef,
|
||||
}
|
||||
|
||||
unsafe impl<T> Send for Proxy<T> {}
|
||||
unsafe impl<T> Sync for Proxy<T> {}
|
||||
unsafe impl<T: Send> Send for Proxy<T> {}
|
||||
|
||||
impl<T> Clone for Proxy<T> {
|
||||
fn clone(&self) -> Self {
|
||||
|
||||
Reference in New Issue
Block a user