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

Unified Diff: base/task_scheduler/task_tracker.h

Issue 2857613002: Synchronize memory in TaskTracker::Flush(). (Closed)
Patch Set: update_comment_in_header_file 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 | « no previous file | base/task_scheduler/task_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/task_tracker.h
diff --git a/base/task_scheduler/task_tracker.h b/base/task_scheduler/task_tracker.h
index 14ca1f419329dc9cb890eab9e9693f5419d8d250..e83eb568a0436b05db0127e0d7290dce9f9e902a 100644
--- a/base/task_scheduler/task_tracker.h
+++ b/base/task_scheduler/task_tracker.h
@@ -117,9 +117,9 @@ class BASE_EXPORT TaskTracker {
const std::unique_ptr<State> state_;
// Number of undelayed tasks that haven't completed their execution. Is
- // incremented and decremented without a barrier. When it reaches zero,
- // |flush_lock_| is acquired (forcing memory synchronization) and |flush_cv_|
- // is signaled.
+ // decremented with a memory barrier after a task runs. Is accessed with an
+ // acquire memory barrier in Flush(). The memory barriers ensure that the
+ // memory written by flushed tasks is visible when Flush() returns.
subtle::Atomic32 num_pending_undelayed_tasks_ = 0;
// Lock associated with |flush_cv_|. Partially synchronizes access to
« no previous file with comments | « no previous file | base/task_scheduler/task_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698