Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schulhof <gabriel.schulhof@intel.com>2020-04-16 17:23:31 +0300
committerGabriel Schulhof <gabriel.schulhof@intel.com>2020-04-16 22:52:12 +0300
commitd3d5eca657474f25fab47036fef9469efc211d8a (patch)
tree26e7f0f73143337933b939b60ec15054683ccf46 /src/node_api.cc
parenta9da65699a43f81076a1560e09ae97ad5630c35f (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 'src/node_api.cc')
-rw-r--r--src/node_api.cc5
1 files changed, 0 insertions, 5 deletions
diff --git a/src/node_api.cc b/src/node_api.cc
index 552538c6f05..fad9cf72a97 100644
--- a/src/node_api.cc
+++ b/src/node_api.cc
@@ -129,7 +129,6 @@ class ThreadSafeFunction : public node::AsyncResource {
is_closing(false),
context(context_),
max_queue_size(max_queue_size_),
- main_thread(uv_thread_self()),
env(env_),
finalize_data(finalize_data_),
finalize_cb(finalize_cb_),
@@ -149,15 +148,12 @@ class ThreadSafeFunction : public node::AsyncResource {
napi_status Push(void* data, napi_threadsafe_function_call_mode mode) {
node::Mutex::ScopedLock lock(this->mutex);
- uv_thread_t current_thread = uv_thread_self();
while (queue.size() >= max_queue_size &&
max_queue_size > 0 &&
!is_closing) {
if (mode == napi_tsfn_nonblocking) {
return napi_queue_full;
- } else if (uv_thread_equal(&current_thread, &main_thread)) {
- return napi_would_deadlock;
}
cond->Wait(lock);
}
@@ -438,7 +434,6 @@ class ThreadSafeFunction : public node::AsyncResource {
// means we don't need the mutex to read them.
void* context;
size_t max_queue_size;
- uv_thread_t main_thread;
// These are variables accessed only from the loop thread.
v8impl::Persistent<v8::Function> ref;