function foreignCallback
source · line 55public
@Unsafe
@Intrinsic("foreign_callback_register")
public fun <F> foreignCallback(callback: Any, contextIndex: Long, mode: ForeignCallbackMode): ForeignCallback<F>
Registers a managed non-suspending function behind a native trampoline. F must be an explicit concrete C-safe signature; contextIndex and mode are compile-time constants, and the context parameter is Ptr<Unit>. Reusable owners release after native unregister. A successful one-shot launch transfers its worker ownership to the callback; retain a separate observer before that transfer when needed.
parameter callback
source · line 58public
callback: Any
type parameter F
source · line 57public
F
parameter contextIndex
source · line 59public
contextIndex: Long
parameter mode
source · line 60public
mode: ForeignCallbackMode