Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send + Sync is not implemented for iOS proxy #656

Closed
jkelleyrtp opened this issue Dec 30, 2022 · 1 comment · Fixed by #658
Closed

Send + Sync is not implemented for iOS proxy #656

jkelleyrtp opened this issue Dec 30, 2022 · 1 comment · Fixed by #658

Comments

@jkelleyrtp
Copy link
Contributor

jkelleyrtp commented Dec 30, 2022

On mac, windows, and linux, the proxy type has an unsafe impl so the proxy can be shared across threads

pub struct Proxy<T> {
  sender: Sender<T>,
  source: CFRunLoopSourceRef,
}

unsafe impl<T: Send> Send for Proxy<T> {}
unsafe impl<T: Send> Sync for Proxy<T> {}

But this does not exist for iOS.

I have to hack around this limitation by doing these impls myself. It'd be great if this was just built in.

@amrbashir amrbashir transferred this issue from tauri-apps/wry Jan 2, 2023
@amrbashir
Copy link
Member

amrbashir commented Jan 2, 2023

I think it is probably safe to implement Sync for it but I am not sure since I can't test it, however, Send is implemented for the proxy on iOS

pub struct EventLoopProxy<T> {
sender: Sender<T>,
source: CFRunLoopSourceRef,
}
unsafe impl<T: Send> Send for EventLoopProxy<T> {}

Shouldn't that be enough? like you can create a new proxy and just send it to the thread instead of sending a reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants