diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2012-04-14 13:54:10 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2012-04-14 13:54:10 +0000 |
commit | 63faed5b8e4f2755f127fcb8aa440480c0649327 (patch) | |
tree | 19c69a04768629f2d440944b71cbe90adae0b615 /lib/Support/ManagedStatic.cpp | |
parent | d4c8b5d2e851b0e8a063c6bf8543a4823a26c15a (diff) |
Notes
Diffstat (limited to 'lib/Support/ManagedStatic.cpp')
-rw-r--r-- | lib/Support/ManagedStatic.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Support/ManagedStatic.cpp b/lib/Support/ManagedStatic.cpp index c767c15e71c9d..098cccb68df51 100644 --- a/lib/Support/ManagedStatic.cpp +++ b/lib/Support/ManagedStatic.cpp @@ -27,8 +27,15 @@ void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(), if (Ptr == 0) { void* tmp = Creator ? Creator() : 0; + TsanHappensBefore(this); sys::MemoryFence(); + + // This write is racy against the first read in the ManagedStatic + // accessors. The race is benign because it does a second read after a + // memory fence, at which point it isn't possible to get a partial value. + TsanIgnoreWritesBegin(); Ptr = tmp; + TsanIgnoreWritesEnd(); DeleterFn = Deleter; // Add to list of managed statics. @@ -72,4 +79,3 @@ void llvm::llvm_shutdown() { if (llvm_is_multithreaded()) llvm_stop_multithreaded(); } - |