Interface SignalAccumulator

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

Functional interface declaration of the SignalAccumulator callback.

See Also:
  • Method Details

    • run

      boolean run(SignalInvocationHint ihint, Value returnAccu, Value handlerReturn, @Nullable MemorySegment data)

      The signal accumulator is a special callback function that can be used to collect return values of the various callbacks that are called during a signal emission.

      The signal accumulator is specified at signal creation time, if it is left null, no accumulation of callback return values is performed. The return value of signal emissions is then the value returned by the last callback.

      Parameters:
      ihint - Signal invocation hint, see GSignalInvocationHint.
      returnAccu - Accumulator to collect callback return values in, this is the return value of the current signal emission.
      handlerReturn - A GValue holding the return value of the signal handler.
      data - Callback data that was specified when creating the signal.
      Returns:
      The accumulator function returns whether the signal emission should be aborted. Returning true will continue with the signal emission. Returning false will abort the current emission. Since 2.62, returning false will skip to the CLEANUP stage. In this case, emission will occur as normal in the CLEANUP stage and the handler's return value will be accumulated.
    • upcall

      default int upcall(MemorySegment ihint, MemorySegment returnAccu, MemorySegment handlerReturn, MemorySegment data)
      The upcall method is called from native code. The parameters are marshaled and run(SignalInvocationHint, Value, Value, MemorySegment) is executed.
    • toCallback

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