summaryrefslogtreecommitdiff
path: root/tests/napi/src/lib.rs
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-10-02 10:43:42 -0700
committerGitHub <noreply@github.com>2024-10-02 10:43:42 -0700
commitbbd4ae1bc12dc6b34d4a455015096b7113a5cec5 (patch)
tree1d91babfa3fdfe47d0a3b01809081150ede27628 /tests/napi/src/lib.rs
parent1837aed79b77b3137563d4730d02e466c85b2b87 (diff)
fix(node): implement libuv APIs needed to support `npm:sqlite3` (#25893)
Fixes #24740. Implements the `uv_mutex_*` and `uv_async_*` APIs. The mutex API is implemented exactly as libuv, a thin wrapper over the OS's native mutex. The async API is implemented in terms of napi_async_work. As documented in the napi docs, you really shouldn't call `napi_queue_async_work` multiple times (it is documented as undefined behavior). However, our implementation doesn't have any issue with this, so I believe it suits our purpose here.
Diffstat (limited to 'tests/napi/src/lib.rs')
-rw-r--r--tests/napi/src/lib.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/napi/src/lib.rs b/tests/napi/src/lib.rs
index f6fe6e189..8c6190ad3 100644
--- a/tests/napi/src/lib.rs
+++ b/tests/napi/src/lib.rs
@@ -31,6 +31,7 @@ pub mod strings;
pub mod symbol;
pub mod tsfn;
pub mod typedarray;
+pub mod uv;
#[macro_export]
macro_rules! cstr {
@@ -138,6 +139,7 @@ unsafe extern "C" fn napi_register_module_v1(
#[cfg(windows)]
{
napi_sys::setup();
+ libuv_sys_lite::setup();
}
// We create a fresh exports object and leave the passed
@@ -169,6 +171,7 @@ unsafe extern "C" fn napi_register_module_v1(
symbol::init(env, exports);
make_callback::init(env, exports);
object::init(env, exports);
+ uv::init(env, exports);
init_cleanup_hook(env, exports);