Skip to content

Commit

Permalink
impl Sync for IdleHandle
Browse files Browse the repository at this point in the history
Make IdleHandle implement the Sync bound on all platforms. This is required to wrap IdleHandle in any Arc, motivated in particular by ArcWaker which is in turn motivated by async Xilem experiments (see #2184)
  • Loading branch information
raphlinus committed May 18, 2022
1 parent f63ab10 commit d83190c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions druid-shell/src/backend/mac/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,7 @@ unsafe impl HasRawWindowHandle for WindowHandle {
}

unsafe impl Send for IdleHandle {}
unsafe impl Sync for IdleHandle {}

impl IdleHandle {
fn add_idle(&self, idle: IdleKind) {
Expand Down
1 change: 1 addition & 0 deletions druid-shell/src/backend/web/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ impl WindowHandle {
}

unsafe impl Send for IdleHandle {}
unsafe impl Sync for IdleHandle {}

impl IdleHandle {
/// Add an idle handler, which is called (once) when the main thread is idle.
Expand Down
1 change: 1 addition & 0 deletions druid-shell/src/backend/windows/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2236,6 +2236,7 @@ impl WindowHandle {

// There is a tiny risk of things going wrong when hwnd is sent across threads.
unsafe impl Send for IdleHandle {}
unsafe impl Sync for IdleHandle {}

impl IdleHandle {
/// Add an idle handler, which is called (once) when the message loop
Expand Down

0 comments on commit d83190c

Please sign in to comment.