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

Unified Diff: base/threading/thread_local_storage.h

Issue 1222123002: Fix a race in ThreadLocalStorage::StaticSlot::initialized which triggers a TSAN error. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix MSVC compile warning. Created 5 years, 5 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/threading/thread_local_storage.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/thread_local_storage.h
diff --git a/base/threading/thread_local_storage.h b/base/threading/thread_local_storage.h
index 50f88685a57ba43c1b8c3d6ecd41c4b98cc2449e..195bff683c3bb8b7a3a23aec30f87ccfb25e7cbe 100644
--- a/base/threading/thread_local_storage.h
+++ b/base/threading/thread_local_storage.h
@@ -5,6 +5,7 @@
#ifndef BASE_THREADING_THREAD_LOCAL_STORAGE_H_
#define BASE_THREADING_THREAD_LOCAL_STORAGE_H_
+#include "base/atomicops.h"
#include "base/base_export.h"
#include "base/basictypes.h"
@@ -114,10 +115,12 @@ class BASE_EXPORT ThreadLocalStorage {
// value 'value'.
void Set(void* value);
- bool initialized() const { return initialized_; }
+ bool initialized() const {
+ return base::subtle::Acquire_Load(&initialized_) != 0;
+ }
// The internals of this struct should be considered private.
- bool initialized_;
+ base::subtle::Atomic32 initialized_;
int slot_;
};
« no previous file with comments | « no previous file | base/threading/thread_local_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698