Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Unified Diff: base/task_scheduler/scheduler_worker_pool_impl.h

Issue 2806413002: Separate the create and start phases in SchedulerSingleThreadTaskRunnerManager. (Closed)
Patch Set: CR-robliao-45-initial-state-comment Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/task_scheduler/scheduler_worker.cc ('k') | base/task_scheduler/scheduler_worker_pool_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/scheduler_worker_pool_impl.h
diff --git a/base/task_scheduler/scheduler_worker_pool_impl.h b/base/task_scheduler/scheduler_worker_pool_impl.h
index f9b04a1d2fd3076e733f9fc9efada51c063fbc09..7b285a54d38a84d6380f97bc19e4945f414cae9d 100644
--- a/base/task_scheduler/scheduler_worker_pool_impl.h
+++ b/base/task_scheduler/scheduler_worker_pool_impl.h
@@ -147,12 +147,12 @@ class BASE_EXPORT SchedulerWorkerPoolImpl : public SchedulerWorkerPool {
// All workers owned by this worker pool. Initialized by Start() within the
// scope of |idle_workers_stack_lock_|. Never modified afterwards (i.e. can be
- // read without synchronization once |workers_created_.IsSignaled()|).
+ // read without synchronization once |workers_created_.IsSet()|).
std::vector<scoped_refptr<SchedulerWorker>> workers_;
// Suggested reclaim time for workers. Initialized by Start(). Never modified
// afterwards (i.e. can be read without synchronization once
- // |workers_created_.IsSignaled()|).
+ // |workers_created_.IsSet()|).
TimeDelta suggested_reclaim_time_;
// Synchronizes access to |idle_workers_stack_|,
@@ -172,7 +172,9 @@ class BASE_EXPORT SchedulerWorkerPoolImpl : public SchedulerWorkerPool {
// Signaled when all workers become idle.
std::unique_ptr<ConditionVariable> idle_workers_stack_cv_for_testing_;
- // Number of wake ups that occurred before Start().
+ // Number of wake ups that occurred before Start(). Never modified after
+ // Start() (i.e. can be read without synchronization once
+ // |workers_created_.IsSet()|).
int num_wake_ups_before_start_ = 0;
// Signaled once JoinForTesting() has returned.
@@ -183,8 +185,8 @@ class BASE_EXPORT SchedulerWorkerPoolImpl : public SchedulerWorkerPool {
AtomicFlag worker_detachment_disallowed_;
#if DCHECK_IS_ON()
- // Signaled when all workers have been created.
- mutable WaitableEvent workers_created_;
+ // Set when all workers have been created.
+ AtomicFlag workers_created_;
#endif
// TaskScheduler.DetachDuration.[worker pool name] histogram. Intentionally
« no previous file with comments | « base/task_scheduler/scheduler_worker.cc ('k') | base/task_scheduler/scheduler_worker_pool_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698