Skip to content

Commit 0471aae

Browse files
Costy Blokhlzha101
authored andcommitted
enable atomic operations in std::shared_ptr
1 parent d3fd8b4 commit 0471aae

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

sdk/tlibcxx/include/memory

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
701701
template <class _ValueType>
702702
inline _LIBCPP_INLINE_VISIBILITY
703703
_ValueType __libcpp_relaxed_load(_ValueType const* __value) {
704-
#if !defined(_LIBCPP_HAS_NO_THREADS) && \
704+
#if defined(_LIBCPP_SGX_HAS_CXX_ATOMIC) && \
705705
defined(__ATOMIC_RELAXED) && \
706706
(__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
707707
return __atomic_load_n(__value, __ATOMIC_RELAXED);
@@ -713,7 +713,7 @@ _ValueType __libcpp_relaxed_load(_ValueType const* __value) {
713713
template <class _ValueType>
714714
inline _LIBCPP_INLINE_VISIBILITY
715715
_ValueType __libcpp_acquire_load(_ValueType const* __value) {
716-
#if !defined(_LIBCPP_HAS_NO_THREADS) && \
716+
#if defined(_LIBCPP_SGX_HAS_CXX_ATOMIC) && \
717717
defined(__ATOMIC_ACQUIRE) && \
718718
(__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC))
719719
return __atomic_load_n(__value, __ATOMIC_ACQUIRE);
@@ -2452,7 +2452,7 @@ template <class _Tp>
24522452
inline _LIBCPP_INLINE_VISIBILITY _Tp
24532453
__libcpp_atomic_refcount_increment(_Tp& __t) _NOEXCEPT
24542454
{
2455-
#if defined(_LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT) && !defined(_LIBCPP_HAS_NO_THREADS)
2455+
#if defined(_LIBCPP_SGX_HAS_CXX_ATOMIC)
24562456
return __atomic_add_fetch(&__t, 1, __ATOMIC_RELAXED);
24572457
#else
24582458
return __t += 1;
@@ -2463,7 +2463,7 @@ template <class _Tp>
24632463
inline _LIBCPP_INLINE_VISIBILITY _Tp
24642464
__libcpp_atomic_refcount_decrement(_Tp& __t) _NOEXCEPT
24652465
{
2466-
#if defined(_LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT) && !defined(_LIBCPP_HAS_NO_THREADS)
2466+
#if defined(_LIBCPP_SGX_HAS_CXX_ATOMIC)
24672467
return __atomic_add_fetch(&__t, -1, __ATOMIC_ACQ_REL);
24682468
#else
24692469
return __t -= 1;

sdk/tlibcxx/src/include/atomic_support.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
4040

4141
namespace {
4242

43-
#if defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS)
43+
#if defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && defined(_LIBCPP_SGX_HAS_CXX_ATOMIC)
4444

4545
enum __libcpp_atomic_order {
4646
_AO_Relaxed = __ATOMIC_RELAXED,

0 commit comments

Comments
 (0)