LWG issue 2143: ios_base::xalloc should be thread-safe
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192539 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1206720869
commit
206ce1faaf
@ -216,6 +216,10 @@ storage-class-specifier const error_category& iostream_category;
|
|||||||
#include <__locale>
|
#include <__locale>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
|
|
||||||
|
#if __has_feature(cxx_atomic)
|
||||||
|
#include <atomic> // for __xindex_
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
#endif
|
||||||
@ -363,7 +367,11 @@ private:
|
|||||||
int* __index_;
|
int* __index_;
|
||||||
size_t __event_size_;
|
size_t __event_size_;
|
||||||
size_t __event_cap_;
|
size_t __event_cap_;
|
||||||
|
#if __has_feature(cxx_atomic)
|
||||||
|
static atomic<int> __xindex_;
|
||||||
|
#else
|
||||||
static int __xindex_;
|
static int __xindex_;
|
||||||
|
#endif
|
||||||
long* __iarray_;
|
long* __iarray_;
|
||||||
size_t __iarray_size_;
|
size_t __iarray_size_;
|
||||||
size_t __iarray_cap_;
|
size_t __iarray_cap_;
|
||||||
|
@ -149,8 +149,11 @@ ios_base::getloc() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// xalloc
|
// xalloc
|
||||||
|
#if __has_feature(cxx_atomic)
|
||||||
|
atomic<int> ios_base::__xindex_ = ATOMIC_VAR_INIT(0);
|
||||||
|
#else
|
||||||
int ios_base::__xindex_ = 0;
|
int ios_base::__xindex_ = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
ios_base::xalloc()
|
ios_base::xalloc()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user