summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/api/n-api.md22
-rw-r--r--src/js_native_api.h2
-rw-r--r--src/node_api.h4
-rw-r--r--src/node_api_types.h12
-rw-r--r--src/node_version.h2
-rw-r--r--test/js-native-api/test_general/test.js4
-rw-r--r--test/node-api/test_threadsafe_function/binding.c1
7 files changed, 23 insertions, 24 deletions
diff --git a/doc/api/n-api.md b/doc/api/n-api.md
index fa30b8290f..2b061167f6 100644
--- a/doc/api/n-api.md
+++ b/doc/api/n-api.md
@@ -282,7 +282,7 @@ This is an opaque pointer that is used to represent a JavaScript value.
### napi_threadsafe_function
-> Stability: 1 - Experimental
+> Stability: 2 - Stable
This is an opaque pointer that represents a JavaScript function which can be
called asynchronously from multiple threads via
@@ -290,7 +290,7 @@ called asynchronously from multiple threads via
### napi_threadsafe_function_release_mode
-> Stability: 1 - Experimental
+> Stability: 2 - Stable
A value to be given to `napi_release_threadsafe_function()` to indicate whether
the thread-safe function is to be closed immediately (`napi_tsfn_abort`) or
@@ -305,7 +305,7 @@ typedef enum {
### napi_threadsafe_function_call_mode
-> Stability: 1 - Experimental
+> Stability: 2 - Stable
A value to be given to `napi_call_threadsafe_function()` to indicate whether
the call should block whenever the queue associated with the thread-safe
@@ -400,7 +400,7 @@ typedef void (*napi_async_complete_callback)(napi_env env,
#### napi_threadsafe_function_call_js
-> Stability: 1 - Experimental
+> Stability: 2 - Stable
Function pointer used with asynchronous thread-safe function calls. The callback
will be called on the main thread. Its purpose is to use a data item arriving
@@ -4526,7 +4526,7 @@ prevent the event loop from exiting. The APIs `napi_ref_threadsafe_function` and
### napi_create_threadsafe_function
-> Stability: 1 - Experimental
+> Stability: 2 - Stable
<!-- YAML
added: v10.6.0
@@ -4569,7 +4569,7 @@ parameters and with `undefined` as its `this` value.
### napi_get_threadsafe_function_context
-> Stability: 1 - Experimental
+> Stability: 2 - Stable
<!-- YAML
added: v10.6.0
@@ -4587,7 +4587,7 @@ This API may be called from any thread which makes use of `func`.
### napi_call_threadsafe_function
-> Stability: 1 - Experimental
+> Stability: 2 - Stable
<!-- YAML
added: v10.6.0
@@ -4615,7 +4615,7 @@ This API may be called from any thread which makes use of `func`.
### napi_acquire_threadsafe_function
-> Stability: 1 - Experimental
+> Stability: 2 - Stable
<!-- YAML
added: v10.6.0
@@ -4637,7 +4637,7 @@ This API may be called from any thread which will start making use of `func`.
### napi_release_threadsafe_function
-> Stability: 1 - Experimental
+> Stability: 2 - Stable
<!-- YAML
added: v10.6.0
@@ -4665,7 +4665,7 @@ This API may be called from any thread which will stop making use of `func`.
### napi_ref_threadsafe_function
-> Stability: 1 - Experimental
+> Stability: 2 - Stable
<!-- YAML
added: v10.6.0
@@ -4686,7 +4686,7 @@ This API may only be called from the main thread.
### napi_unref_threadsafe_function
-> Stability: 1 - Experimental
+> Stability: 2 - Stable
<!-- YAML
added: v10.6.0
diff --git a/src/js_native_api.h b/src/js_native_api.h
index 60f209f948..acb7316d2d 100644
--- a/src/js_native_api.h
+++ b/src/js_native_api.h
@@ -12,7 +12,7 @@
#define NAPI_VERSION NAPI_VERSION_EXPERIMENTAL
#else
// The baseline version for N-API
-#define NAPI_VERSION 3
+#define NAPI_VERSION 4
#endif
#endif
diff --git a/src/node_api.h b/src/node_api.h
index b36f6d4b7a..a37ee06ce1 100644
--- a/src/node_api.h
+++ b/src/node_api.h
@@ -192,7 +192,7 @@ NAPI_EXTERN napi_status napi_close_callback_scope(napi_env env,
#endif // NAPI_VERSION >= 3
-#ifdef NAPI_EXPERIMENTAL
+#if NAPI_VERSION >= 4
// Calling into JS from other threads
NAPI_EXTERN napi_status
@@ -230,7 +230,7 @@ napi_unref_threadsafe_function(napi_env env, napi_threadsafe_function func);
NAPI_EXTERN napi_status
napi_ref_threadsafe_function(napi_env env, napi_threadsafe_function func);
-#endif // NAPI_EXPERIMENTAL
+#endif // NAPI_VERSION >= 4
EXTERN_C_END
diff --git a/src/node_api_types.h b/src/node_api_types.h
index ab4f7ac58c..d740bb9358 100644
--- a/src/node_api_types.h
+++ b/src/node_api_types.h
@@ -6,11 +6,11 @@
typedef struct napi_callback_scope__* napi_callback_scope;
typedef struct napi_async_context__* napi_async_context;
typedef struct napi_async_work__* napi_async_work;
-#ifdef NAPI_EXPERIMENTAL
+#if NAPI_VERSION >= 4
typedef struct napi_threadsafe_function__* napi_threadsafe_function;
-#endif // NAPI_EXPERIMENTAL
+#endif // NAPI_VERSION >= 4
-#ifdef NAPI_EXPERIMENTAL
+#ifdef NAPI_VERSION >= 4
typedef enum {
napi_tsfn_release,
napi_tsfn_abort
@@ -20,19 +20,19 @@ typedef enum {
napi_tsfn_nonblocking,
napi_tsfn_blocking
} napi_threadsafe_function_call_mode;
-#endif // NAPI_EXPERIMENTAL
+#endif // NAPI_VERSION >= 4
typedef void (*napi_async_execute_callback)(napi_env env,
void* data);
typedef void (*napi_async_complete_callback)(napi_env env,
napi_status status,
void* data);
-#ifdef NAPI_EXPERIMENTAL
+#ifdef NAPI_VERSION >= 4
typedef void (*napi_threadsafe_function_call_js)(napi_env env,
napi_value js_callback,
void* context,
void* data);
-#endif // NAPI_EXPERIMENTAL
+#endif // NAPI_VERSION >= 4
typedef struct {
uint32_t major;
diff --git a/src/node_version.h b/src/node_version.h
index b3f4808bf1..f64aa2aad7 100644
--- a/src/node_version.h
+++ b/src/node_version.h
@@ -118,6 +118,6 @@
#define NODE_MODULE_VERSION 68
// the NAPI_VERSION provided by this version of the runtime
-#define NAPI_VERSION 3
+#define NAPI_VERSION 4
#endif // SRC_NODE_VERSION_H_
diff --git a/test/js-native-api/test_general/test.js b/test/js-native-api/test_general/test.js
index 7a65297cd3..720918f964 100644
--- a/test/js-native-api/test_general/test.js
+++ b/test/js-native-api/test_general/test.js
@@ -33,8 +33,8 @@ assert.notStrictEqual(test_general.testGetPrototype(baseObject),
test_general.testGetPrototype(extendedObject));
// test version management functions
-// expected version is currently 3
-assert.strictEqual(test_general.testGetVersion(), 3);
+// expected version is currently 4
+assert.strictEqual(test_general.testGetVersion(), 4);
[
123,
diff --git a/test/node-api/test_threadsafe_function/binding.c b/test/node-api/test_threadsafe_function/binding.c
index c985178c5a..c556c9427c 100644
--- a/test/node-api/test_threadsafe_function/binding.c
+++ b/test/node-api/test_threadsafe_function/binding.c
@@ -4,7 +4,6 @@
// which, in turn, may affect the ABI stability of the project despite its use
// of N-API.
#include <uv.h>
-#define NAPI_EXPERIMENTAL
#include <node_api.h>
#include "../../js-native-api/common.h"