From d83190c2ead09c01ed664147cfcbbf22336a55c4 Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Wed, 18 May 2022 06:45:06 -0700 Subject: [PATCH] impl Sync for IdleHandle 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) --- druid-shell/src/backend/mac/window.rs | 1 + druid-shell/src/backend/web/window.rs | 1 + druid-shell/src/backend/windows/window.rs | 1 + 3 files changed, 3 insertions(+) diff --git a/druid-shell/src/backend/mac/window.rs b/druid-shell/src/backend/mac/window.rs index 836f49543f..a212412cf3 100644 --- a/druid-shell/src/backend/mac/window.rs +++ b/druid-shell/src/backend/mac/window.rs @@ -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) { diff --git a/druid-shell/src/backend/web/window.rs b/druid-shell/src/backend/web/window.rs index 92a0326f52..4dfd1ddfc1 100644 --- a/druid-shell/src/backend/web/window.rs +++ b/druid-shell/src/backend/web/window.rs @@ -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. diff --git a/druid-shell/src/backend/windows/window.rs b/druid-shell/src/backend/windows/window.rs index 1a0c64bde7..e580325ce6 100644 --- a/druid-shell/src/backend/windows/window.rs +++ b/druid-shell/src/backend/windows/window.rs @@ -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