pub fn read(&self) -> result::Result<u64, io::Error> {
        let mut buf: u64 = 0;
        let ret = unsafe {
            // This is safe because we made this fd and the pointer we
            // pass can not overflow because we give the syscall's size parameter properly.
            read(
                self.as_raw_fd(),
                &mut buf as *mut u64 as *mut c_void,
                mem::size_of::<u64>(),
            )
        };
        if ret < 0 {
            Err(io::Error::last_os_error())
        } else {
            Ok(buf)
        }
    }
/// Tries to read from the eventfd, does not block if the counter is zero
Tries to read from the eventfd, does not block if the counter is zero
Tries to read from the eventfd does not block if the counter is zero
pub fn read(&self) -> result::Result<u64, io::Error> {
        let mut buf: u64 = 0;
        let ret = unsafe {
            // This is safe because we made this fd and the pointer we
            // pass can not overflow because we give the syscall's size parameter properly.
            read(
                self.as_raw_fd(),
                &mut buf as *mut u64 as *mut c_void,
                mem::size_of::<u64>(),
            )
        };
        if ret < 0 {
            Err(io::Error::last_os_error())
        } else {
            Ok(buf)
        }
    }
pub fn read ( & self ) -> result :: Result < u64 , io :: Error > { let mut buf : u64 = 0 ; let ret = unsafe { // This is safe because we made this fd and the pointer we // pass can not overflow because we give the syscall's size parameter properly. read ( self . as_raw_fd ( ) , & mut buf as * mut u64 as * mut c_void , mem :: size_of :: < u64 > ( ) , ) } ; if ret < 0 { Err ( io :: Error :: last_os_error ( ) ) } else { Ok ( buf ) } }
Tries to read from the eventfd, does not block if the counter is zero
Tries to read from the eventfd does not block if the counter is zero
&self
&self