You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HWND used to be a wrapper of isize, like HWND(pub isize), this meant it was also Send+Sync.
Now that HWND is:
pub struct HWND(pub *mut core::ffi::c_void);
It means it's not automatically Sync + Send. I don't see why it couldn't be Sync+Send because HWNDs are single-use values, and multiple threads and processes already use them.
My suggestion is to do this:
unsafe impl Sync for HWND {}
unsafe impl Send for HWND {}
This has been discussed in #3169. In a nutshell, handles are used in too many different ways to mark them all as Send and Sync. As an example, DestroyWindow cannot be called from a thread other than the window's owning thread.
Activity
tim-weis commentedon Dec 18, 2024
This has been discussed in #3169. In a nutshell, handles are used in too many different ways to mark them all as
SendandSync. As an example,DestroyWindowcannot be called from a thread other than the window's owning thread.