diff options
author | Gabriel Schulhof <gabriel.schulhof@intel.com> | 2020-04-16 17:23:31 +0300 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2020-04-17 20:43:40 +0300 |
commit | 076ba3150dedbc02419a11d026df0fb371b2f74f (patch) | |
tree | 756d7d29911c640d5e8e028a44a1dec86e8d9be9 /doc/api | |
parent | a09bf3ad5f434566a5be3eae3f7cc487c2384600 (diff) |
Revert "n-api: detect deadlocks in thread-safe function"
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>
Diffstat (limited to 'doc/api')
-rw-r--r-- | doc/api/n-api.md | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/doc/api/n-api.md b/doc/api/n-api.md index eda1d94f728..a38ebbd6f86 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -457,7 +457,6 @@ typedef enum { napi_date_expected, napi_arraybuffer_expected, napi_detachable_arraybuffer_expected, - napi_would_deadlock, } napi_status; ``` @@ -5096,12 +5095,6 @@ preventing data from being successfully added to the queue. If set to `napi_call_threadsafe_function()` never blocks if the thread-safe function was created with a maximum queue size of 0. -As a special case, when `napi_call_threadsafe_function()` is called from the -main thread, it will return `napi_would_deadlock` if the queue is full and it -was called with `napi_tsfn_blocking`. The reason for this is that the main -thread is responsible for reducing the number of items in the queue so, if it -waits for room to become available on the queue, then it will deadlock. - The actual call into JavaScript is controlled by the callback given via the `call_js_cb` parameter. `call_js_cb` is invoked on the main thread once for each value that was placed into the queue by a successful call to @@ -5238,12 +5231,6 @@ This API may be called from any thread which makes use of `func`. <!-- YAML added: v10.6.0 napiVersion: 4 -changes: - - version: REPLACEME - pr-url: https://github.com/nodejs/node/pull/32689 - description: > - Return `napi_would_deadlock` when called with `napi_tsfn_blocking` from - the main thread and the queue is full. --> ```C @@ -5261,13 +5248,9 @@ napi_call_threadsafe_function(napi_threadsafe_function func, `napi_tsfn_nonblocking` to indicate that the call should return immediately with a status of `napi_queue_full` whenever the queue is full. -This API will return `napi_would_deadlock` if called with `napi_tsfn_blocking` -from the main thread and the queue is full. - This API will return `napi_closing` if `napi_release_threadsafe_function()` was -called with `abort` set to `napi_tsfn_abort` from any thread. - -The value is only added to the queue if the API returns `napi_ok`. +called with `abort` set to `napi_tsfn_abort` from any thread. The value is only +added to the queue if the API returns `napi_ok`. This API may be called from any thread which makes use of `func`. |