pub struct AsyncPidFd(/* private fields */);Expand description
An async wrapper around PidFd for asynchronous process waiting.
This type allows waiting for a process to exit asynchronously, integrating with
async runtimes via the async-io crate. The pidfd becomes readable when the
process exits.
Only available when the async feature is enabled (which is the default).
Implementations§
Source§impl AsyncPidFd
impl AsyncPidFd
Sourcepub async fn wait(&self) -> Result<ExitStatus>
pub async fn wait(&self) -> Result<ExitStatus>
Asynchronously waits for the process to exit and returns its exit status.
This method waits until the pidfd becomes readable (which happens when the process exits), then retrieves the exit status.
§Examples
#![cfg_attr(feature = "nightly", feature(linux_pidfd))]
use pidfd_util::{PidFd, PidFdExt, AsyncPidFd};
let pidfd = PidFd::from_pid(1234)?;
let async_pidfd: AsyncPidFd = pidfd.try_into()?;
let status = async_pidfd.wait().await?;Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AsyncPidFd
impl !RefUnwindSafe for AsyncPidFd
impl Send for AsyncPidFd
impl !Sync for AsyncPidFd
impl Unpin for AsyncPidFd
impl UnsafeUnpin for AsyncPidFd
impl !UnwindSafe for AsyncPidFd
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more