Interface SourceFunc

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 SourceFunc extends FunctionPointer

Functional interface declaration of the SourceFunc callback.

See Also:
  • Method Details

    • run

      boolean run()

      Specifies the type of function passed to GLib.timeoutAdd(int, int, SourceFunc), GLib.timeoutAddFull, GLib.idleAdd(int, SourceFunc), and GLib.idleAddFull.

      When calling Source.setCallback(SourceFunc), you may need to cast a function of a different type to this type. Use GLib.SOURCEFUNC to avoid warnings about incompatible function types.

      Returns:
      false if the source should be removed. GLib.SOURCE_CONTINUE and GLib.SOURCE_REMOVE are more memorable names for the return value.
    • upcall

      default int upcall(MemorySegment userData)
      The upcall method is called from native code. The parameters are marshaled and run() is executed.
    • toCallback

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