mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-25 04:56:13 +08:00
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. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282640 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user