From 1751f863d62a134345f4e8ff9538c9beed63e420 Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 4 Oct 2023 23:40:09 +0800 Subject: [PATCH 1/2] feat: ensure impl Send and Sync for Event Signed-off-by: tison --- src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f3fe698..6b6ac0e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -71,7 +71,6 @@ use std::num::NonZeroUsize; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Mutex; use std::time::Duration; -use std::usize; use cfg_if::cfg_if; @@ -121,7 +120,7 @@ cfg_if! { pub mod os; /// Key associated with notifications. -const NOTIFY_KEY: usize = std::usize::MAX; +const NOTIFY_KEY: usize = usize::MAX; /// Indicates that a file descriptor or socket can read or write without blocking. #[derive(Debug, Clone, Copy, PartialEq, Eq)] @@ -136,6 +135,9 @@ pub struct Event { extra: sys::EventExtra, } +unsafe impl Send for Event {} +unsafe impl Sync for Event {} + /// The mode in which the poller waits for I/O events. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[non_exhaustive] From 8fea306393646064dfb0efd921dfc8d0608d1c0c Mon Sep 17 00:00:00 2001 From: tison Date: Fri, 6 Oct 2023 10:57:17 +0800 Subject: [PATCH 2/2] dedup Signed-off-by: tison --- src/lib.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 6b6ac0e..cbebaf9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -135,9 +135,6 @@ pub struct Event { extra: sys::EventExtra, } -unsafe impl Send for Event {} -unsafe impl Sync for Event {} - /// The mode in which the poller waits for I/O events. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[non_exhaustive]