From 664119841a92d13a297e88032f9985fe7e35f77c Mon Sep 17 00:00:00 2001 From: dave caruso Date: Mon, 21 Aug 2023 16:26:07 -0700 Subject: Implement `napi_ref_threadsafe_function` (#4156) * Implement napi_ref_threadsafe_function * work on this * i hate event loops * little better * clean --- src/bun.js/base.zig | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/bun.js/base.zig') diff --git a/src/bun.js/base.zig b/src/bun.js/base.zig index b08b82c40..e72e196a3 100644 --- a/src/bun.js/base.zig +++ b/src/bun.js/base.zig @@ -1682,6 +1682,14 @@ pub const PollRef = struct { this.status = .active; vm.uws_event_loop.?.refConcurrently(); } + + pub fn refConcurrentlyFromEventLoop(this: *PollRef, loop: *JSC.EventLoop) void { + this.refConcurrently(loop.virtual_machine); + } + + pub fn unrefConcurrentlyFromEventLoop(this: *PollRef, loop: *JSC.EventLoop) void { + this.unrefConcurrently(loop.virtual_machine); + } }; const KQueueGenerationNumber = if (Environment.isMac and Environment.allow_assert) usize else u0; -- cgit v1.2.3