Skip to main content

threadSafe

method Deno.UnsafeCallback.threadSafe
Jump to headingUnsafeCallback.threadSafe<Definition extends UnsafeCallbackDefinition = UnsafeCallbackDefinition>(
definition: Definition,
callback: UnsafeCallbackFunction<Definition["parameters"], Definition["result"]>,
): UnsafeCallback<Definition>

Creates an UnsafeCallback and calls ref() once to allow it to wake up the Deno event loop when called from foreign threads.

This also stops Deno's process from exiting while the callback still exists and is not unref'ed.

Type Parameters Jump to heading

Parameters Jump to heading

Return Type Jump to heading

Back to top