Interface PollFunc

All Superinterfaces:
FunctionPointer
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface @Generated("org.javagi.JavaGI") public interface PollFunc extends FunctionPointer

Functional interface declaration of the PollFunc callback.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    run(PollFD ufds, int nfsd, int timeout)
    Specifies the type of function passed to g_main_context_set_poll_func().
    Creates a native function pointer to the upcall(MemorySegment, int, int) method.
    default int
    upcall(MemorySegment ufds, int nfsd, int timeout)
    The upcall method is called from native code.
  • Method Details

    • run

      int run(PollFD ufds, int nfsd, int timeout)
      Specifies the type of function passed to g_main_context_set_poll_func(). The semantics of the function should match those of the poll() system call.
      Parameters:
      ufds - an array of GPollFD elements
      nfsd - the number of elements in ufds
      timeout - the maximum time to wait for an event of the file descriptors. A negative value indicates an infinite timeout.
      Returns:
      the number of GPollFD elements which have events or errors reported, or -1 if an error occurred.
    • upcall

      default int upcall(MemorySegment ufds, int nfsd, int timeout)
      The upcall method is called from native code. The parameters are marshaled and run(PollFD, int, int) is executed.
    • toCallback

      default MemorySegment toCallback(Arena arena)
      Creates a native function pointer to the upcall(MemorySegment, int, int) method.
      Specified by:
      toCallback in interface FunctionPointer
      Parameters:
      arena - the arena in which the function pointer is allocated
      Returns:
      the native function pointer