runInAsyncScope
fun <This, Result> runInAsyncScope(fn: Function<Result>, thisArg: This = definedExternally, vararg args: Any?): Result(source)
Call the provided function with the provided arguments in the execution context of the async resource. This will establish the context, trigger the AsyncHooks before callbacks, call the function, trigger the AsyncHooks after callbacks, and then restore the original execution context.
Since
v9.6.0
Parameters
fn
The function to call in the execution context of this async resource.
thisArg
The receiver to be used for the function call.
args
Optional arguments to pass to the function.