-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: reduce platform worker barrier lifetime #23419
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nodejs-github-bot
added
the
c++
Issues and PRs that require attention from people who are familiar with C++.
label
Oct 11, 2018
addaleax
approved these changes
Oct 11, 2018
benjamingr
approved these changes
Oct 11, 2018
thefourtheye
approved these changes
Oct 11, 2018
Minor cleanup in the lifetime for the platform worker initialization synchronization barrier.
ofrobots
force-pushed
the
platform-worker-fields-scope
branch
from
October 11, 2018 13:36
5ca7269
to
3b8648d
Compare
ofrobots
added
the
author ready
PRs that have at least one approval, no pending requests for changes, and a CI started.
label
Oct 11, 2018
bnoordhuis
approved these changes
Oct 11, 2018
jasnell
approved these changes
Oct 12, 2018
lundibundi
approved these changes
Oct 12, 2018
cjihrig
approved these changes
Oct 12, 2018
Landed in 9f7e3a4. |
ofrobots
added a commit
that referenced
this pull request
Oct 13, 2018
Minor cleanup in the lifetime for the platform worker initialization synchronization barrier. PR-URL: #23419 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Denys Otrishko <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Should this be backported to 10.x? If so, a separate backport PR is needed. Diffdiff --cc src/node_platform.cc
index ad0cd0db3e,047cb43268..0000000000
--- a/src/node_platform.cc
+++ b/src/node_platform.cc
@@@ -161,22 -166,27 +161,36 @@@ class BackgroundTaskRunner::DelayedTask
std::unordered_set<uv_timer_t*> timers_;
};
++<<<<<<< HEAD
+BackgroundTaskRunner::BackgroundTaskRunner(int thread_pool_size) {
+ Mutex::ScopedLock lock(platform_workers_mutex_);
+ pending_platform_workers_ = thread_pool_size;
++=======
+ WorkerThreadsTaskRunner::WorkerThreadsTaskRunner(int thread_pool_size) {
+ Mutex platform_workers_mutex;
+ ConditionVariable platform_workers_ready;
+
+ Mutex::ScopedLock lock(platform_workers_mutex);
+ int pending_platform_workers = thread_pool_size;
++>>>>>>> 9f7e3a4040... src: reduce platform worker barrier lifetime
delayed_task_scheduler_.reset(
- new DelayedTaskScheduler(&pending_worker_tasks_));
+ new DelayedTaskScheduler(&background_tasks_));
threads_.push_back(delayed_task_scheduler_->Start());
for (int i = 0; i < thread_pool_size; i++) {
PlatformWorkerData* worker_data = new PlatformWorkerData{
++<<<<<<< HEAD
+ &background_tasks_, &platform_workers_mutex_,
+ &platform_workers_ready_, &pending_platform_workers_, i
++=======
+ &pending_worker_tasks_, &platform_workers_mutex,
+ &platform_workers_ready, &pending_platform_workers, i
++>>>>>>> 9f7e3a4040... src: reduce platform worker barrier lifetime
};
std::unique_ptr<uv_thread_t> t { new uv_thread_t() };
- if (uv_thread_create(t.get(), PlatformWorkerThread,
- worker_data) != 0) {
+ if (uv_thread_create(t.get(), BackgroundRunner, worker_data) != 0)
break;
- }
threads_.push_back(std::move(t));
} |
jasnell
pushed a commit
that referenced
this pull request
Oct 17, 2018
Minor cleanup in the lifetime for the platform worker initialization synchronization barrier. PR-URL: #23419 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Denys Otrishko <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
There is no pressing need to backport it, but I can if necessary (to unblock other backports). |
andrewhughes101
pushed a commit
to andrewhughes101/node
that referenced
this pull request
Jul 29, 2019
Minor cleanup in the lifetime for the platform worker initialization synchronization barrier. PR-URL: nodejs#23419 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Denys Otrishko <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
BethGriggs
pushed a commit
that referenced
this pull request
Sep 20, 2019
Minor cleanup in the lifetime for the platform worker initialization synchronization barrier. PR-URL: #23419 Backport-PR-URL: #28844 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Denys Otrishko <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Merged
addaleax
added
the
v8 platform
Issues and PRs related to Node's v8::Platform implementation.
label
Feb 18, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
author ready
PRs that have at least one approval, no pending requests for changes, and a CI started.
c++
Issues and PRs that require attention from people who are familiar with C++.
v8 platform
Issues and PRs related to Node's v8::Platform implementation.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Minor cleanup in the lifetime for the platform worker initialization
synchronization barrier.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesCI: https://ci.nodejs.org/job/node-test-pull-request/17740/