Skip to content

Commit 151a914

Browse files
Apply documentation suggestions from code review
Documentation updates Co-authored-by: Gabriel Schulhof <[email protected]>
1 parent 3405b2b commit 151a914

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

doc/threadsafe_function_ex.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ of:
77
- `ContextType = std::nullptr_t`: The thread-safe function's context. By default,
88
a TSFN has no context.
99
- `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.
1111
- `Callback = void(*)(Napi::Env, Napi::Function jsCallback, ContextType*,
1212
DataType*)`: The callback to run for each item added to the queue. If no
1313
`Callback` is given, the API will call the function `jsCallback` with no
@@ -102,7 +102,7 @@ When targetting version 5+, `callback` may be:
102102
103103
### Acquire
104104
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
106106
will start making use of the thread-safe function.
107107
108108
```cpp
@@ -117,10 +117,10 @@ Returns one of:
117117

118118
### Release
119119

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
121121
function. A thread should call this API when it stops making use of this
122122
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.
124124

125125
```cpp
126126
napi_status Napi::ThreadSafeFunctionEx<ContextType, DataType, Callback>::Release()
@@ -134,7 +134,7 @@ Returns one of:
134134

135135
### Abort
136136

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
138138
with the thread-safe function except `Release()` to return `napi_closing` even
139139
before its reference count reaches zero. In particular, `BlockingCall` and
140140
`NonBlockingCall()` will return `napi_closing`, thus informing the threads that
@@ -173,11 +173,10 @@ napi_status Napi::ThreadSafeFunctionEx<ContextType, DataType, Callback>::NonBloc
173173
`ThreadSafeFunctionEx::New()`.
174174

175175
Returns one of:
176-
- `napi_ok`: The call was successfully added to the queue.
176+
- `napi_ok`: `data` was successfully added to the queue.
177177
- `napi_queue_full`: The queue was full when trying to call in a non-blocking
178178
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.
181180
- `napi_invalid_arg`: The thread-safe function is closed.
182181
- `napi_generic_failure`: A generic error occurred when attemping to add to the
183182
queue.

0 commit comments

Comments
 (0)