Skip to main content

EventPair

Struct EventPair 

Source
pub struct EventPair { /* private fields */ }
Expand description

Lightweight cross-process event signalling using Unix pipes.

Two independent pipes provide bidirectional wake-up:

  • daw_to_host: DAW writes a byte to wake the host process.
  • host_to_daw: Host writes a byte to signal completion.

Implementations§

Source§

impl EventPair

Source

pub fn new() -> Result<Self>

Create two pipes. Returns Err if pipe(2) fails.

Source

pub unsafe fn from_fds( daw_to_host_read: RawFd, host_to_daw_write: RawFd, ) -> Self

§Safety

daw_to_host_read and host_to_daw_write must be valid, already-open file descriptors inherited from the parent process.

Source

pub fn daw_write_fd(&self) -> RawFd

Source

pub fn daw_read_fd(&self) -> RawFd

Source

pub fn signal_host(&self) -> Result<()>

DAW wakes the host.

Source

pub fn wait_host(&self, timeout: Duration) -> Result<()>

DAW waits for host completion (with timeout).

Source

pub fn host_read_fd(&self) -> RawFd

Source

pub fn host_write_fd(&self) -> RawFd

Source

pub fn wait_daw(&self, timeout: Duration) -> Result<()>

Host waits for DAW wake (with timeout).

Source

pub fn signal_daw(&self) -> Result<()>

Host signals completion to DAW.

Source

pub fn close_daw_unused(&mut self)

Close the file descriptors that the DAW side does not need. Call this on the DAW after spawning the child.

Source

pub fn close_host_unused(&mut self)

Close the file descriptors that the host side does not need. Call this on the host after constructing from inherited fds.

Trait Implementations§

Source§

impl Drop for EventPair

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.