From 4fcb36096c9f5e11f9e0ecc6638e7c85c2ba3b7a Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Thu, 7 Mar 2024 13:53:46 +0900 Subject: [PATCH] Remove uneeded impl Send for TokenCell & doc upd. --- unified-scheduler-logic/src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/unified-scheduler-logic/src/lib.rs b/unified-scheduler-logic/src/lib.rs index 9010410f47c347..2c155cc8534434 100644 --- a/unified-scheduler-logic/src/lib.rs +++ b/unified-scheduler-logic/src/lib.rs @@ -225,13 +225,13 @@ mod utils { } } - // Safety: Access to `TokenCell` is assumed to be only from a single thread by proper use of - // Token once after `TokenCell` is sent to the thread from other threads; So, both implementing - // Send and Sync can be thought as safe. + // Safety: Once after a (`Send`-able) `TokenCell` is transferred to a thread from other + // threads, access to `TokenCell` is assumed to be only from the single thread by proper use of + // Token. Thereby, implementing `Sync` can be thought as safe and doing so is needed for the + // particular implementation pattern in the unified scheduler (multi-threaded off-loading). // - // In other words, TokenCell is technically still `!Send` and `!Sync`. But there should be no - // legalized usage which depends on real `Send` and `Sync` to avoid undefined behaviors. - unsafe impl Send for TokenCell {} + // In other words, TokenCell is technically still `!Sync`. But there should be no + // legalized usage which depends on real `Sync` to avoid undefined behaviors. unsafe impl Sync for TokenCell {} /// A auxiliary zero-sized type to enforce aliasing rule to [`TokenCell`] via rust type system