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 Summary
Modifier and TypeMethodDescriptionbooleanrun(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.default MemorySegmenttoCallback(Arena arena) Creates a native function pointer to theupcall(MemorySegment, MemorySegment, MemorySegment, MemorySegment)method.default intupcall(MemorySegment ihint, MemorySegment returnAccu, MemorySegment handlerReturn, MemorySegment data) Theupcallmethod is called from native code.
-
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, seeGSignalInvocationHint.returnAccu- Accumulator to collect callback return values in, this is the return value of the current signal emission.handlerReturn- AGValueholding 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
truewill continue with the signal emission. Returningfalsewill abort the current emission. Since 2.62, returningfalsewill 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) Theupcallmethod is called from native code. The parameters are marshaled andrun(SignalInvocationHint, Value, Value, MemorySegment)is executed. -
toCallback
Creates a native function pointer to theupcall(MemorySegment, MemorySegment, MemorySegment, MemorySegment)method.- Specified by:
toCallbackin interfaceFunctionPointer- Parameters:
arena- the arena in which the function pointer is allocated- Returns:
- the native function pointer
-