-
Notifications
You must be signed in to change notification settings - Fork 51
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
Should RawWindowHandle
implement Send
?
#85
Comments
Except pointers are !Send And this isn't a super big deal because (unlike Copy) a type can always just force Send onto whatever data it wants. |
I can't speak to macOS, and I don't particularly have a need for
Methods like This isn't to say windows don't have thread affinity - they do. A window is owned by a thread and cannot be transfered. But they can be referenced by other threads, and the You might wish to argue
That leaves runtime enforcement of lifetimes. Fortunately there are many options:
|
On Wayland the raw window handle is However I do have a question on how it interacts with the graphics API usually? For example if I want to render a window on a different thread, I must pass |
The thing with X11 is that whether or not the windows/displays are thread safe depends. My answer would be "no", since, even if the user wants to send a |
Closing this issue as I believe the long-standing consensus is now "window handles are !Send/!Sync". |
Windows are apparently effectively
!Send
on Windows and macOS, and the lifetime issues that Android's window handles have make marking window handlesSend
perhaps a bit suspect.I believe we should treat
RawWindowHandle
s somewhat like pointers, in that they can be constructed by safe code, but can't be used directly withoutunsafe
. Thus, we should make the handlesSend
, but provide enough information in order for user code to tell if they're using the handle on the correct thread. Additionally, any API creating ready-madeRawWindowHandle
s must be unsafe, as is already the case withHasRawWindowHandle
. This all assumes we can find a workable solution to #84.The text was updated successfully, but these errors were encountered: