Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a1aff28
deps: cherry-pick 525b396 from V8 upstream
psmarshall Dec 14, 2018
b17819d
doc: update the http.request.setTimeout docs to be accurate
jbunton-atlassian Dec 19, 2018
fbafe8d
test: fix test-repl-envvars
addaleax Dec 26, 2018
759a018
n-api: add API for asynchronous functions
Jun 17, 2018
c5a11dc
n-api: fix compiler warning
cjihrig Jun 29, 2018
3675059
n-api: guard against cond null dereference
Jul 18, 2018
67b6e0d
src: fix may be uninitialized warning in n-api
mhdawson Jul 19, 2018
09b88aa
n-api: remove idle_running from TsFn
Jul 27, 2018
902b079
n-api: clean up thread-safe function
Aug 11, 2018
6b7cccc
doc: fix optional parameters in n-api.md
Sep 21, 2018
fe43282
n-api: add missing handle scopes
danbev Oct 31, 2018
60db455
test: mark test_threadsafe_function/test as flaky
gireeshpunathil Nov 29, 2018
d4b6643
test: mark test-cli-node-options flaky on arm
Trott Dec 14, 2018
f6ff8c5
test: fix module loading error for AIX 7.1
richardlau Jan 9, 2019
e936907
build: set `-blibpath:` for AIX
richardlau Jan 11, 2019
1a9582b
tools: allow input for TTY tests
addaleax Sep 24, 2018
ea5628e
process: allow reading from stdout/stderr sockets
addaleax Sep 24, 2018
c56f3ed
test: add stdin writable regression test
addaleax Sep 24, 2018
b4c5435
test: add process.stdin.end() TTY regression test
mcollina Sep 17, 2018
44609d1
n-api: restrict exports by version
kfarnung Dec 7, 2017
d6ffabc
n-api: mark thread-safe function as stable
Jan 22, 2019
1d86261
http: attach reused parser to correct domain
Jan 11, 2019
ac9b8f7
http: fix error check in `Execute()`
mscdex Feb 5, 2019
2b2ad96
n-api: finalize during second-pass callback
Feb 7, 2019
6352288
build: add loader path to rpath for cctest
rubys Sep 29, 2018
c07ba96
build: skip cctest on Windows shared lib build
yhwang Jul 24, 2018
91620b8
tls: fix legacy SecurePair session resumption
bnoordhuis Mar 5, 2019
7573b55
tls: fix legacy SecurePair clienthello race window
bnoordhuis Mar 5, 2019
97cc0fc
deps: V8: cherry-pick 3cc6919
Feb 1, 2019
3128cb7
test: avoid running fsync on directory on AIX
jBarz Jun 13, 2018
eaf474c
test: shared lib build doesn't handle SIGPIPE
yhwang Mar 7, 2018
705935d
assert: fix backport regression
BridgeAR Apr 12, 2019
d3de1ed
n-api: improve performance creating strings
anthony-tuininga Mar 4, 2019
5f93cf7
2019-04-16, Version 8.16.0 'Carbon' (LTS)
MylesBorins Mar 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
n-api: add API for asynchronous functions
Bundle a `uv_async_t`, a `uv_idle_t`, a `uv_mutex_t`, a `uv_cond_t`,
and a `v8::Persistent<v8::Function>` to make it possible to call into JS
from another thread. The API accepts a void data pointer and a callback
which will be invoked on the loop thread and which will receive the
`napi_value` representing the JavaScript function to call so as to
perform the call into JS. The callback is run inside a
`node::CallbackScope`.

A `std::queue<void*>` is used to store calls from the secondary
threads, and an idle loop is started by the `uv_async_t` callback on the
loop thread to drain the queue, calling into JS with each item.

Items can be added to the queue blockingly or non-blockingly.

The thread-safe function can be referenced or unreferenced, with the
same semantics as libuv handles.

Re: nodejs/help#1035
Re: #20964
Fixes: #13512
Backport-PR-URL: #25002
PR-URL: #17887
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
  • Loading branch information
Gabriel Schulhof authored and rvagg committed Feb 28, 2019
commit 759a0180b5194686692caab955e371c5efc82e4e
25 changes: 25 additions & 0 deletions doc/api/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,31 @@ multiple of the element size.
While calling `napi_create_typedarray()`, `(length * size_of_element) +
byte_offset` was larger than the length of given `buffer`.

<a id="ERR_NAPI_TSFN_CALL_JS"></a>
### ERR_NAPI_TSFN_CALL_JS

An error occurred while invoking the JavaScript portion of the thread-safe
function.

<a id="ERR_NAPI_TSFN_GET_UNDEFINED"></a>
### ERR_NAPI_TSFN_GET_UNDEFINED

An error occurred while attempting to retrieve the JavaScript `undefined`
value.

<a id="ERR_NAPI_TSFN_START_IDLE_LOOP"></a>
### ERR_NAPI_TSFN_START_IDLE_LOOP

On the main thread, values are removed from the queue associated with the
thread-safe function in an idle loop. This error indicates that an error
has occurred when attemping to start the loop.

<a id="ERR_NAPI_TSFN_STOP_IDLE_LOOP"></a>
### ERR_NAPI_TSFN_STOP_IDLE_LOOP

Once no more items are left in the queue, the idle loop must be suspended. This
error indicates that the idle loop has failed to stop.

<a id="ERR_NO_ICU"></a>
### ERR_NO_ICU

Expand Down
372 changes: 371 additions & 1 deletion doc/api/n-api.md

Large diffs are not rendered by default.

Loading