Make atomic mode panics have clear messages

This commit is contained in:
Ruihan Li
2024-11-18 23:35:21 +08:00
committed by Tate, Hongliang Tian
parent 065a3bd1c3
commit 969ac97144
13 changed files with 31 additions and 0 deletions

View File

@ -32,6 +32,7 @@ pub trait Pause: WaitTimeout {
/// condition is met.
///
/// [`EINTR`]: crate::error::Errno::EINTR
#[track_caller]
fn pause_until<F, R>(&self, cond: F) -> Result<R>
where
F: FnMut() -> Option<R>,
@ -49,6 +50,7 @@ pub trait Pause: WaitTimeout {
///
/// [`ETIME`]: crate::error::Errno::ETIME
/// [`EINTR`]: crate::error::Errno::EINTR
#[track_caller]
fn pause_until_or_timeout<'a, F, T, R>(&self, mut cond: F, timeout: T) -> Result<R>
where
F: FnMut() -> Option<R>,
@ -74,6 +76,7 @@ pub trait Pause: WaitTimeout {
/// [`ETIME`]: crate::error::Errno::ETIME
/// [`EINTR`]: crate::error::Errno::EINTR
#[doc(hidden)]
#[track_caller]
fn pause_until_or_timeout_impl<F, R>(
&self,
cond: F,
@ -94,6 +97,7 @@ pub trait Pause: WaitTimeout {
///
/// [`ETIME`]: crate::error::Errno::ETIME
/// [`EINTR`]: crate::error::Errno::EINTR
#[track_caller]
fn pause_timeout<'a>(&self, timeout: impl Into<TimeoutExt<'a>>) -> Result<()>;
}

View File

@ -368,6 +368,7 @@ pub trait Pollable {
/// 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 opitions where the events are consumed by another thread.
#[track_caller]
fn wait_events<F, R>(
&self,
mask: IoEvents,