7
7
- ` ContextType = std::nullptr_t ` : The thread-safe function's context. By default,
8
8
a TSFN has no context.
9
9
- ` DataType = void* ` : The data to use in the native callback. By default, a TSFN
10
- can accept * any* data type.
10
+ can accept any data type.
11
11
- `Callback = void(* )(Napi::Env, Napi::Function jsCallback, ContextType* ,
12
12
DataType* )`: The callback to run for each item added to the queue. If no
13
13
` Callback ` is given, the API will call the function ` jsCallback ` with no
@@ -102,7 +102,7 @@ When targetting version 5+, `callback` may be:
102
102
103
103
### Acquire
104
104
105
- Add a thread to this thread-safe function object, indicating that a new thread
105
+ Adds a thread to this thread-safe function object, indicating that a new thread
106
106
will start making use of the thread-safe function.
107
107
108
108
```cpp
@@ -117,10 +117,10 @@ Returns one of:
117
117
118
118
### Release
119
119
120
- Indicate that an existing thread will stop making use of the thread-safe
120
+ Indicates that an existing thread will stop making use of the thread-safe
121
121
function. A thread should call this API when it stops making use of this
122
122
thread-safe function. Using any thread-safe APIs after having called this API
123
- has undefined results in the current thread, as it may have been destroyed.
123
+ has undefined results in the current thread, as the thread-safe function may have been destroyed.
124
124
125
125
``` cpp
126
126
napi_status Napi::ThreadSafeFunctionEx<ContextType, DataType, Callback>::Release()
@@ -134,7 +134,7 @@ Returns one of:
134
134
135
135
### Abort
136
136
137
- "Abort " the thread-safe function. This will cause all subsequent APIs associated
137
+ "Aborts " the thread-safe function. This will cause all subsequent APIs associated
138
138
with the thread-safe function except ` Release() ` to return ` napi_closing ` even
139
139
before its reference count reaches zero. In particular, ` BlockingCall ` and
140
140
` NonBlockingCall() ` will return ` napi_closing ` , thus informing the threads that
@@ -173,11 +173,10 @@ napi_status Napi::ThreadSafeFunctionEx<ContextType, DataType, Callback>::NonBloc
173
173
` ThreadSafeFunctionEx::New() ` .
174
174
175
175
Returns one of:
176
- - ` napi_ok ` : The call was successfully added to the queue.
176
+ - ` napi_ok ` : ` data ` was successfully added to the queue.
177
177
- ` napi_queue_full ` : The queue was full when trying to call in a non-blocking
178
178
method.
179
- - ` napi_closing ` : The thread-safe function is aborted and cannot accept more
180
- calls.
179
+ - ` napi_closing ` : The thread-safe function is aborted and no further calls can be made.
181
180
- ` napi_invalid_arg ` : The thread-safe function is closed.
182
181
- ` napi_generic_failure ` : A generic error occurred when attemping to add to the
183
182
queue.
0 commit comments