Class Eventfd


  • @Include("#include <sys/eventfd.h>")
    public final class Eventfd
    extends Object
    Wrapper around the linux <sys/eventfd.h> header. execute man eventfd on linux to get more informations.
    Author:
    aploese
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  Eventfd.eventfd_t  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int EFD_CLOEXEC
      Linux: Set the close-on-exec (FD_CLOEXEC) flag on the new file descriptor.
      static int EFD_NONBLOCK
      Linux: Set the O_NONBLOCK file status flag on the open file description (see open(2)) referred to by the new file descriptor..
      static int EFD_SEMAPHORE
      Linux: Provide semaphore-like semantics for reads from the new file descriptor.
      static boolean HAVE_SYS_EVENTFD_H  
    • Field Detail

      • EFD_CLOEXEC

        @Define
        public static final int EFD_CLOEXEC
        Linux: Set the close-on-exec (FD_CLOEXEC) flag on the new file descriptor.
      • EFD_NONBLOCK

        @Define
        public static final int EFD_NONBLOCK
        Linux: Set the O_NONBLOCK file status flag on the open file description (see open(2)) referred to by the new file descriptor..
      • EFD_SEMAPHORE

        @Define
        public static final int EFD_SEMAPHORE
        Linux: Provide semaphore-like semantics for reads from the new file descriptor.
      • HAVE_SYS_EVENTFD_H

        public static final boolean HAVE_SYS_EVENTFD_H
    • Method Detail

      • eventfd

        public static final int eventfd​(int count,
                                        int flags)
                                 throws NativeErrorException
        Linux: eventfd - create a file descriptor for event notification. eventfd creates an "eventfd object" that can be used as an event wait/notify mechanism by user-space applications, and by the kernel to notify user-space applications of events.
        Parameters:
        count - the initial value of the counter.
        flags - EFD_CLOEXEC | EFD_NONBLOCK| EFD_SEMAPHORE.
        Returns:
        a new file descriptor that can be used to refer to the eventfd object.
        Throws:
        NativeErrorException - if the return value of the native function indicates an error.
      • eventfd_read

        public static final long eventfd_read​(int fd)
                                       throws NativeErrorException
        Additional glibc feature to make read from an eventfd simpler.
        Parameters:
        fd - a valid file descriptor from a call to eventfd.
        Returns:
        the 2. parameter of the catice call value a 8 byte buffer to hold the readed value.
        Throws:
        NativeErrorException - if the return value of the native function indicates an error.
      • eventfd_write

        public static final void eventfd_write​(int fd,
                                               long value)
                                        throws NativeErrorException
        Additional glibc feature to make write to an eventfd simpler.
        Parameters:
        fd - a valid file descriptor from a call to eventfd.
        value - the 8 bytes to be to write out.
        Throws:
        NativeErrorException - if the return value of the native function indicates an error.