summaryrefslogtreecommitdiff
path: root/cli/dts/lib.deno.unstable.d.ts
diff options
context:
space:
mode:
authorAapo Alasuutari <aapo.alasuutari@gmail.com>2022-06-28 12:23:36 +0300
committerGitHub <noreply@github.com>2022-06-28 14:53:36 +0530
commit00f4521b205bf25c79f0fa7c9a6840941342bda4 (patch)
treeb988db360143384ae216022846b518ceb262c80a /cli/dts/lib.deno.unstable.d.ts
parente1c90963fbbf6571ae1b66971b83159681928ec3 (diff)
feat(ext/ffi): Thread safe callbacks (#14942)
Diffstat (limited to 'cli/dts/lib.deno.unstable.d.ts')
-rw-r--r--cli/dts/lib.deno.unstable.d.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts
index ab6f8634f..ac27648fe 100644
--- a/cli/dts/lib.deno.unstable.d.ts
+++ b/cli/dts/lib.deno.unstable.d.ts
@@ -565,6 +565,9 @@ declare namespace Deno {
* as C function pointers to ffi calls.
*
* The function pointer remains valid until the `close()` method is called.
+ *
+ * The callback can be explicitly ref'ed and deref'ed to stop Deno's
+ * process from exiting.
*/
export class UnsafeCallback<
Definition extends UnsafeCallbackDefinition = UnsafeCallbackDefinition,
@@ -584,6 +587,30 @@ declare namespace Deno {
Definition["result"]
>;
+ /**
+ * Adds one to this callback's reference counting.
+ *
+ * If the callback's reference count becomes non-zero, it will keep
+ * Deno's process from exiting.
+ */
+ ref(): void;
+
+ /**
+ * Removes one from this callback's reference counting.
+ *
+ * If the callback's reference counter becomes zero, it will no longer
+ * keep Deno's process from exiting.
+ */
+ unref(): void;
+
+ /**
+ * Removes the C function pointer associated with the UnsafeCallback.
+ * Continuing to use the instance after calling this object will lead to errors
+ * and crashes.
+ *
+ * Calling this method will also immediately set the callback's reference
+ * counting to zero and it will no longer keep Deno's process from exiting.
+ */
close(): void;
}