Revert "Make `pause_timeout` return `EINTR`"
This reverts commit 6421fd0b36.
This commit is contained in:
parent
12aa9fc857
commit
0c114e911b
|
|
@ -86,9 +86,10 @@ pub trait Pause: WaitTimeout {
|
||||||
///
|
///
|
||||||
/// # Errors
|
/// # Errors
|
||||||
///
|
///
|
||||||
/// This method will return an error with
|
/// This method will return an error with [`ETIME`] if the timeout is reached.
|
||||||
/// - [`EINTR`] if a signal is received;
|
///
|
||||||
/// - [`ETIME`] if the timeout is reached.
|
/// Unlike other methods in the trait, this method will _not_ return an error with [`EINTR`] if
|
||||||
|
/// a signal is received (FIXME).
|
||||||
///
|
///
|
||||||
/// [`ETIME`]: crate::error::Errno::ETIME
|
/// [`ETIME`]: crate::error::Errno::ETIME
|
||||||
/// [`EINTR`]: crate::error::Errno::EINTR
|
/// [`EINTR`]: crate::error::Errno::EINTR
|
||||||
|
|
@ -107,10 +108,10 @@ impl Pause for Waiter {
|
||||||
// No fast paths for `Waiter`. If the caller wants a fast path, it should do so _before_
|
// No fast paths for `Waiter`. If the caller wants a fast path, it should do so _before_
|
||||||
// the waiter is created.
|
// the waiter is created.
|
||||||
|
|
||||||
let Some(posix_thread) = self
|
let current_thread = self.task().data().downcast_ref::<Arc<Thread>>();
|
||||||
.task()
|
|
||||||
.data()
|
let Some(posix_thread) = current_thread
|
||||||
.downcast_ref::<Arc<Thread>>()
|
.as_ref()
|
||||||
.and_then(|thread| thread.as_posix_thread())
|
.and_then(|thread| thread.as_posix_thread())
|
||||||
else {
|
else {
|
||||||
return self.wait_until_or_timeout_cancelled(cond, || Ok(()), timeout);
|
return self.wait_until_or_timeout_cancelled(cond, || Ok(()), timeout);
|
||||||
|
|
@ -141,13 +142,12 @@ impl Pause for Waiter {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
let posix_thread_opt = self
|
let current_thread = self.task().data().downcast_ref::<Arc<Thread>>();
|
||||||
.task()
|
|
||||||
.data()
|
|
||||||
.downcast_ref::<Arc<Thread>>()
|
|
||||||
.and_then(|thread| thread.as_posix_thread());
|
|
||||||
|
|
||||||
if let Some(posix_thread) = posix_thread_opt {
|
if let Some(posix_thread) = current_thread
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|thread| thread.as_posix_thread())
|
||||||
|
{
|
||||||
posix_thread.set_signalled_waker(self.waker());
|
posix_thread.set_signalled_waker(self.waker());
|
||||||
self.wait();
|
self.wait();
|
||||||
posix_thread.clear_signalled_waker();
|
posix_thread.clear_signalled_waker();
|
||||||
|
|
@ -163,16 +163,6 @@ impl Pause for Waiter {
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
if posix_thread_opt
|
|
||||||
.as_ref()
|
|
||||||
.is_some_and(|posix_thread| posix_thread.has_pending())
|
|
||||||
{
|
|
||||||
return_errno_with_message!(
|
|
||||||
Errno::EINTR,
|
|
||||||
"the current thread is interrupted by a signal"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue