pub fn new() -> result::Result<EventFd, io::Error> {
        // This is safe because eventfd merely allocated an eventfd for our process and we handle
        // the error case.
        let ret = unsafe { eventfd(0, EFD_NONBLOCK) };
        if ret < 0 {
            Err(io::Error::last_os_error())
        } else {
            // This is safe because we checked ret for success and know the kernel gave us an fd that we
            // own.
            Ok(EventFd {
                eventfd: unsafe { File::from_raw_fd(ret) },
            })
        }
    }
/// Creates a new blocking EventFd with an initial value of 0.
Creates a new blocking EventFd with an initial value of 0.
Creates a new blocking EventFd with an initial value of 0 .
pub fn new() -> result::Result<EventFd, io::Error> {
        // This is safe because eventfd merely allocated an eventfd for our process and we handle
        // the error case.
        let ret = unsafe { eventfd(0, EFD_NONBLOCK) };
        if ret < 0 {
            Err(io::Error::last_os_error())
        } else {
            // This is safe because we checked ret for success and know the kernel gave us an fd that we
            // own.
            Ok(EventFd {
                eventfd: unsafe { File::from_raw_fd(ret) },
            })
        }
    }
pub fn new ( ) -> result :: Result < EventFd , io :: Error > { // This is safe because eventfd merely allocated an eventfd for our process and we handle // the error case. let ret = unsafe { eventfd ( 0 , EFD_NONBLOCK ) } ; if ret < 0 { Err ( io :: Error :: last_os_error ( ) ) } else { // This is safe because we checked ret for success and know the kernel gave us an fd that we // own. Ok ( EventFd { eventfd : unsafe { File :: from_raw_fd ( ret ) } , } ) } }
Creates a new blocking EventFd with an initial value of 0.
Creates a new blocking EventFd with an initial value of 0 .