From 700ea223600c86586880f5cd2c177ff9155500a2 Mon Sep 17 00:00:00 2001 From: Kevin Mehall Date: Sun, 3 Dec 2023 17:05:30 -0800 Subject: [PATCH] Impl Send+Sync for CFRunLoopTimer, CFRunLoopSource, CFRunLoopObserver Following https://github.com/servo/core-foundation-rs/pull/610, the same reasoning from https://github.com/servo/core-foundation-rs/issues/550 applies to the remaining CFRunLoop types. --- core-foundation/src/runloop.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core-foundation/src/runloop.rs b/core-foundation/src/runloop.rs index e3f1e264..bf9d8995 100644 --- a/core-foundation/src/runloop.rs +++ b/core-foundation/src/runloop.rs @@ -146,6 +146,9 @@ impl CFRunLoop { declare_TCFType!(CFRunLoopTimer, CFRunLoopTimerRef); impl_TCFType!(CFRunLoopTimer, CFRunLoopTimerRef, CFRunLoopTimerGetTypeID); +unsafe impl Send for CFRunLoopTimer {} +unsafe impl Sync for CFRunLoopTimer {} + impl CFRunLoopTimer { pub fn new( fireDate: CFAbsoluteTime, @@ -177,6 +180,9 @@ impl_TCFType!( CFRunLoopSourceGetTypeID ); +unsafe impl Send for CFRunLoopSource {} +unsafe impl Sync for CFRunLoopSource {} + impl CFRunLoopSource { pub fn from_file_descriptor(fd: &CFFileDescriptor, order: CFIndex) -> Option { fd.to_run_loop_source(order) @@ -190,6 +196,9 @@ impl_TCFType!( CFRunLoopObserverGetTypeID ); +unsafe impl Send for CFRunLoopObserver {} +unsafe impl Sync for CFRunLoopObserver {} + #[cfg(test)] mod test { use super::*;