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

Unified Diff: base/lazy_instance.h

Issue 147008: Added dynamic annotation files into base/...,... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 6 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/dynamic_annotations.cc ('k') | base/lazy_instance.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/lazy_instance.h
===================================================================
--- base/lazy_instance.h (revision 18944)
+++ base/lazy_instance.h (working copy)
@@ -37,6 +37,7 @@
#include "base/atomicops.h"
#include "base/basictypes.h"
+#include "base/dynamic_annotations.h"
namespace base {
@@ -96,6 +97,14 @@
if (base::subtle::NoBarrier_Load(&state_) != STATE_CREATED)
EnsureInstance(instance, Traits::New, Traits::Delete);
+ // This annotation helps race detectors recognize correct lock-less
+ // synchronization between different threads calling Pointer().
+ // We suggest dynamic race detection tool that
+ // "ctor(instance)" in EnsureInstance(...) happens before
+ // "return instance" in Pointer().
+ // See the corresponding HAPPENS_BEFORE in EnsureInstance(...).
+ ANNOTATE_HAPPENS_AFTER(&state_);
+
return instance;
}
« no previous file with comments | « base/dynamic_annotations.cc ('k') | base/lazy_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698