From 6df0a3073cc0e61ffa1ce31272ff18b6d8b51a7f Mon Sep 17 00:00:00 2001 From: "Tate, Hongliang Tian" Date: Wed, 14 Aug 2024 11:34:00 +0800 Subject: [PATCH] Add a comment for UserMode --- ostd/src/user.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ostd/src/user.rs b/ostd/src/user.rs index 3290f95af..f36191315 100644 --- a/ostd/src/user.rs +++ b/ostd/src/user.rs @@ -109,8 +109,10 @@ pub struct UserMode<'a> { context: UserContext, } -// An instance of `UserMode` is bound to the current task. So it cannot be [`Send`]. +// An instance of `UserMode` is bound to the current task. So it must not be sent to other tasks. impl<'a> !Send for UserMode<'a> {} +// Note that implementing `!Sync` is unnecessary +// because entering the user space via `UserMode` requires taking a mutable reference. impl<'a> UserMode<'a> { /// Creates a new `UserMode`.