summaryrefslogtreecommitdiffstats
path: root/libcxx/src/mutex.cpp
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-09-28 22:08:13 +0000
committerEric Fiselier <eric@efcs.ca>2016-09-28 22:08:13 +0000
commitea117bf9ad162950a1fdd527f8b75d1bdf22456b (patch)
tree15a1200a1f8fa5699cd0ad28e13e070b063483fe /libcxx/src/mutex.cpp
parent392caa538dfa29757f8f1e8635508affab2b1072 (diff)
downloadbcm5719-llvm-ea117bf9ad162950a1fdd527f8b75d1bdf22456b.tar.gz
bcm5719-llvm-ea117bf9ad162950a1fdd527f8b75d1bdf22456b.zip
Mark libc++ internal globals with _LIBCPP_SAFE_STATIC.
This patch applies the _LIBCPP_SAFE_STATIC attribute to internal globals, most of which are locking primitives, in order to ensure that they can safely be used during program startup. This patch also fixes an unsafe static init issue with the global locks used to implement atomic operations on shared pointers. Previously the locks were initialized using a dynamically initialized pointer, so it was possible that the pointer was uninitialized. llvm-svn: 282640
Diffstat (limited to 'libcxx/src/mutex.cpp')
-rw-r--r--libcxx/src/mutex.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libcxx/src/mutex.cpp b/libcxx/src/mutex.cpp
index 7226abc6a51..dc530ceeac0 100644
--- a/libcxx/src/mutex.cpp
+++ b/libcxx/src/mutex.cpp
@@ -195,8 +195,8 @@ recursive_timed_mutex::unlock() _NOEXCEPT
// keep in sync with: 7741191.
#ifndef _LIBCPP_HAS_NO_THREADS
-static __libcpp_mutex_t mut = _LIBCPP_MUTEX_INITIALIZER;
-static __libcpp_condvar_t cv = _LIBCPP_CONDVAR_INITIALIZER;
+_LIBCPP_SAFE_STATIC static __libcpp_mutex_t mut = _LIBCPP_MUTEX_INITIALIZER;
+_LIBCPP_SAFE_STATIC static __libcpp_condvar_t cv = _LIBCPP_CONDVAR_INITIALIZER;
#endif
void
OpenPOWER on IntegriCloud