Skip to content

Commit

Permalink
Merge pull request #2189 from linebender/sync_idle
Browse files Browse the repository at this point in the history
impl Sync for IdleHandle
  • Loading branch information
raphlinus authored May 18, 2022
2 parents f63ab10 + 990ab98 commit 6c72829
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
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
2 changes: 1 addition & 1 deletion druid-shell/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -716,5 +716,5 @@ mod test {
use static_assertions as sa;

sa::assert_not_impl_any!(WindowHandle: Send, Sync);
sa::assert_impl_all!(IdleHandle: Send);
sa::assert_impl_all!(IdleHandle: Send, Sync);
}

0 comments on commit 6c72829

Please sign in to comment.