pub struct EventFd { /* private fields */ }Expand description
A cross-runtime wake signal backed by a Linux eventfd.
Write to signal, read to consume. Multiple signals coalesce into one. The fd can be registered with any event loop (epoll, io_uring, kqueue fallback).
Implementations§
Source§impl EventFd
impl EventFd
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Create a new eventfd in semaphore mode.
EFD_NONBLOCK ensures reads/writes never block the calling thread.
EFD_CLOEXEC prevents fd leaks across fork/exec.
Sourcepub fn notify(&self) -> Result<()>
pub fn notify(&self) -> Result<()>
Signal the other side to wake up.
Writes 1 to the eventfd counter. Multiple writes accumulate but a single read clears all pending signals.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EventFd
impl RefUnwindSafe for EventFd
impl Unpin for EventFd
impl UnsafeUnpin for EventFd
impl UnwindSafe for EventFd
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