summaryrefslogtreecommitdiff
path: root/test/node-api/test_threadsafe_function
Commit message (Collapse)AuthorAgeFilesLines
* test: add trailing commas in `test/node-api`Antoine du Hamel2023-01-293-17/+17
| | | | | | PR-URL: https://github.com/nodejs/node/pull/46384 Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* node-api: emit uncaught-exception on unhandled tsfn callbackslegendecas2022-05-273-0/+79
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/36510 Fixes: https://github.com/nodejs/node/issues/36402 Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* node-api: faster threadsafe_functionFedor Indutny2021-05-042-2/+11
| | | | | | | | | | | | | | Invoke threadsafe_function during the same tick and avoid marshalling costs between threads and/or churning event loop if either: 1. There's a queued call already 2. `Push()` is called while the main thread was running threadsafe_function PR-URL: https://github.com/nodejs/node/pull/38506 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* test: fix typo in comment in binding.cTobias Nießen2021-04-131-1/+1
| | | | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/38220 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
* test: rename n-api to node-apiGabriel Schulhof2021-02-061-51/+53
| | | | | | | | | | This renames the macros used in the tests from `NAPI_*` to `NODE_API_*`. PR-URL: https://github.com/nodejs/node/pull/37217 Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
* test,doc,lib: adjust object literal newlines for lint ruleRich Trott2021-01-261-1/+2
| | | | | | | | | | | Before enabling object-curly-newline for our ESLint rules, adjust files to comply with it. Refs: https://eslint.org/docs/rules/object-curly-newline PR-URL: https://github.com/nodejs/node/pull/37040 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
* Revert "n-api: detect deadlocks in thread-safe function"Anna Henningsen2020-05-233-67/+4
| | | | | | | | | | | | | | | | | | This reverts commit d26ca06c16f497ffa5ac4845a27922d5058a9318 because it breaks running the tests in debug mode, as `v8::Isolate::GetCurrent()` is not allowed if no `Isolate` is active on the current thread. Refs: https://github.com/nodejs/node/pull/33276 Refs: https://github.com/nodejs/node/pull/32860 PR-URL: https://github.com/nodejs/node/pull/33453 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
* n-api: detect deadlocks in thread-safe functionGabriel Schulhof2020-04-193-4/+67
| | | | | | | | | | | | | We introduce status `napi_would_deadlock` to be used as a return status by `napi_call_threadsafe_function` if the call is made with `napi_tsfn_blocking` on the main thread and the queue is full. Fixes: https://github.com/nodejs/node/issues/32615 Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com> PR-URL: https://github.com/nodejs/node/pull/32860 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Zeyu Yang <himself65@outlook.com>
* Revert "n-api: detect deadlocks in thread-safe function"Gabriel Schulhof2020-04-163-67/+4
| | | | | | | | | | | | | | | | This reverts commit aeb7084fe6446350ec032e9819746126811bf44f. The solution creates incorrect behaviour on Windows. Re: https://github.com/nodejs/node-addon-api/pull/697#issuecomment-612993476 Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com> PR-URL: https://github.com/nodejs/node/pull/32880 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
* n-api: detect deadlocks in thread-safe functionGabriel Schulhof2020-04-093-4/+67
| | | | | | | | | | | | | | | | We introduce status `napi_would_deadlock` to be used as a return status by `napi_call_threadsafe_function` if the call is made with `napi_tsfn_blocking` on the main thread and the queue is full. PR-URL: https://github.com/nodejs/node/pull/32689 Fixes: https://github.com/nodejs/node/issues/32615 Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* n-api: make func argument of napi_create_threadsafe_function optionallegendecas2019-06-212-5/+49
| | | | | | PR-URL: https://github.com/nodejs/node/pull/27791 Refs: https://github.com/nodejs/node/issues/27592 Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
* n-api: mark thread-safe function as stableGabriel Schulhof2019-01-211-1/+0
| | | | | | | | Fixes: https://github.com/nodejs/node/issues/24249 PR-URL: https://github.com/nodejs/node/pull/25556 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* test: partition N-API testsGabriel Schulhof2018-12-043-0/+497
Partition test/addons-napi into test/js-native-api and test/node-api to isolate the Node.js-agnostic portion of the N-API tests from the Node.js-specific portion. PR-URL: https://github.com/nodejs/node/pull/24557 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>