From efd49a96e3eb83094f6bc93f2723ef376b29fabb Mon Sep 17 00:00:00 2001 From: Ruihan Li Date: Fri, 1 Nov 2024 20:02:58 +0800 Subject: [PATCH] Rename `cond()` to `try_op()` --- kernel/src/process/signal/poll.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/kernel/src/process/signal/poll.rs b/kernel/src/process/signal/poll.rs index a7cc8a1b7..9b07dd59b 100644 --- a/kernel/src/process/signal/poll.rs +++ b/kernel/src/process/signal/poll.rs @@ -247,28 +247,28 @@ pub trait Pollable { /// Waits for events and performs event-based operations. /// - /// If a call to `cond()` succeeds or fails with an error code other than `EAGAIN`, the method - /// will return whatever the call to `cond()` returns. Otherwise, the method will wait for some - /// interesting events specified in `mask` to happen and try again. + /// If a call to `try_op()` succeeds or fails with an error code other than `EAGAIN`, the + /// method will return whatever the call to `try_op()` returns. Otherwise, the method will wait + /// for some interesting events specified in `mask` to happen and try again. /// /// This method will fail with `ETIME` if the timeout is specified and the event does not occur /// before the timeout expires. /// - /// The user must ensure that a call to `cond()` does not fail with `EAGAIN` when the + /// The user must ensure that a call to `try_op()` does not fail with `EAGAIN` when the /// interesting events occur. However, it is allowed to have spurious `EAGAIN` failures due to - /// race conditions where the events are consumed by another thread. + /// race opitions where the events are consumed by another thread. fn wait_events( &self, mask: IoEvents, timeout: Option<&Duration>, - mut cond: F, + mut try_op: F, ) -> Result where Self: Sized, F: FnMut() -> Result, { // Fast path: Return immediately if the operation gives a result. - match cond() { + match try_op() { Err(err) if err.error() == Errno::EAGAIN => (), result => return result, } @@ -286,7 +286,7 @@ pub trait Pollable { loop { // Try again after the event happens. - match cond() { + match try_op() { Err(err) if err.error() == Errno::EAGAIN => (), result => return result, };