From fda6c5c092355f9489f80ead1a1778c70a3f1fd2 Mon Sep 17 00:00:00 2001 From: zhangjianqiu Date: Thu, 21 Aug 2025 20:18:42 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=94=AF=E6=8C=81debug=E6=97=B6globalCall?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=B6=85=E6=97=B6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js_concurrent_module/worker/worker.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js_concurrent_module/worker/worker.cpp b/js_concurrent_module/worker/worker.cpp index 9567b788..d32e900d 100644 --- a/js_concurrent_module/worker/worker.cpp +++ b/js_concurrent_module/worker/worker.cpp @@ -1090,7 +1090,7 @@ napi_value Worker::GlobalCall(napi_env env, napi_callback_info cbinfo) return nullptr; } - { + if (!reinterpret_cast(env)->GetIsDebugModeEnabled()) { std::unique_lock lock(worker->globalCallMutex_); if (!worker->cv_.wait_for(lock, std::chrono::milliseconds(timeout), [worker]() { return !worker->workerGlobalCallQueue_.IsEmpty() || !worker->globalCallSuccess_; @@ -1100,6 +1100,12 @@ napi_value Worker::GlobalCall(napi_env env, napi_callback_info cbinfo) ErrorHelper::ThrowError(env, ErrorHelper::ERR_GLOBAL_CALL_TIMEOUT); return nullptr; } + } else { + HILOG_INFO("worker:: no waiting time limitation in debug mode."); + std::unique_lock lock(worker->globalCallMutex_); + worker->cv_.wait(lock, [worker]() { + return !worker->workerGlobalCallQueue_.IsEmpty() || !worker->globalCallSuccess_; + }); } worker->IncreaseGlobalCallId(); if (!worker->globalCallSuccess_) { -- Gitee From fd5999c23c9f54def394f00897ef582a7d3d612e Mon Sep 17 00:00:00 2001 From: zhangjianqiu Date: Fri, 22 Aug 2025 09:24:18 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=94=AF=E6=8C=81debug=E6=97=B6globalCall?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=B6=85=E6=97=B6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangjianqiu --- .vscode/settings.json | 5 +++++ js_concurrent_module/worker/worker.cpp | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..ce8d15f9 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "condition_variable": "cpp" + } +} \ No newline at end of file diff --git a/js_concurrent_module/worker/worker.cpp b/js_concurrent_module/worker/worker.cpp index d32e900d..8378eced 100644 --- a/js_concurrent_module/worker/worker.cpp +++ b/js_concurrent_module/worker/worker.cpp @@ -1103,9 +1103,11 @@ napi_value Worker::GlobalCall(napi_env env, napi_callback_info cbinfo) } else { HILOG_INFO("worker:: no waiting time limitation in debug mode."); std::unique_lock lock(worker->globalCallMutex_); - worker->cv_.wait(lock, [worker]() { + if (worker->cv_.wait(lock, [worker]() { return !worker->workerGlobalCallQueue_.IsEmpty() || !worker->globalCallSuccess_; - }); + })) { + HILOG_WARN("worker:: callGlobalCallObjectMethod may fail."); + } } worker->IncreaseGlobalCallId(); if (!worker->globalCallSuccess_) { -- Gitee From e61f37a56e56a04db65c0f95317efa81aa14538c Mon Sep 17 00:00:00 2001 From: zhangjianqiu Date: Fri, 22 Aug 2025 09:24:18 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=94=AF=E6=8C=81debug=E6=97=B6globalCall?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=B6=85=E6=97=B6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangjianqiu Signed-off-by: 张建秋 --- .vscode/settings.json | 5 +++++ js_concurrent_module/worker/worker.cpp | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..ce8d15f9 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "condition_variable": "cpp" + } +} \ No newline at end of file diff --git a/js_concurrent_module/worker/worker.cpp b/js_concurrent_module/worker/worker.cpp index d32e900d..8378eced 100644 --- a/js_concurrent_module/worker/worker.cpp +++ b/js_concurrent_module/worker/worker.cpp @@ -1103,9 +1103,11 @@ napi_value Worker::GlobalCall(napi_env env, napi_callback_info cbinfo) } else { HILOG_INFO("worker:: no waiting time limitation in debug mode."); std::unique_lock lock(worker->globalCallMutex_); - worker->cv_.wait(lock, [worker]() { + if (worker->cv_.wait(lock, [worker]() { return !worker->workerGlobalCallQueue_.IsEmpty() || !worker->globalCallSuccess_; - }); + })) { + HILOG_WARN("worker:: callGlobalCallObjectMethod may fail."); + } } worker->IncreaseGlobalCallId(); if (!worker->globalCallSuccess_) { -- Gitee From ffad1d616de5ecb1122bcb40771f83f4bed59e3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BB=BA=E7=A7=8B?= Date: Fri, 22 Aug 2025 10:01:26 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=94=AF=E6=8C=81debug=E6=97=B6globalCall?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=B6=85=E6=97=B6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张建秋 --- js_concurrent_module/worker/worker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js_concurrent_module/worker/worker.cpp b/js_concurrent_module/worker/worker.cpp index 8378eced..14d7ab60 100644 --- a/js_concurrent_module/worker/worker.cpp +++ b/js_concurrent_module/worker/worker.cpp @@ -1106,7 +1106,7 @@ napi_value Worker::GlobalCall(napi_env env, napi_callback_info cbinfo) if (worker->cv_.wait(lock, [worker]() { return !worker->workerGlobalCallQueue_.IsEmpty() || !worker->globalCallSuccess_; })) { - HILOG_WARN("worker:: callGlobalCallObjectMethod may fail."); + HILOG_WARN("worker:: callGlobalCallObjectMethod may fail."); //log } } worker->IncreaseGlobalCallId(); -- Gitee From a23323cccd538dd9eb0be891bf375c951190eb7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BB=BA=E7=A7=8B?= Date: Fri, 22 Aug 2025 10:02:21 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=94=AF=E6=8C=81debug=E6=97=B6globalCall?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=B6=85=E6=97=B6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张建秋 --- js_concurrent_module/worker/worker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js_concurrent_module/worker/worker.cpp b/js_concurrent_module/worker/worker.cpp index 14d7ab60..f902b706 100644 --- a/js_concurrent_module/worker/worker.cpp +++ b/js_concurrent_module/worker/worker.cpp @@ -1106,7 +1106,7 @@ napi_value Worker::GlobalCall(napi_env env, napi_callback_info cbinfo) if (worker->cv_.wait(lock, [worker]() { return !worker->workerGlobalCallQueue_.IsEmpty() || !worker->globalCallSuccess_; })) { - HILOG_WARN("worker:: callGlobalCallObjectMethod may fail."); //log + HILOG_WARN("worker:: callGlobalCallObjectMethod may fail."); } } worker->IncreaseGlobalCallId(); -- Gitee