Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] prefer to use std::atomic if available #2291

Merged
merged 1 commit into from
Apr 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions srtcore/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,8 @@

#if defined(ATOMIC_USE_SRT_SYNC_MUTEX) && (ATOMIC_USE_SRT_SYNC_MUTEX == 1)
// NOTE: Defined at the top level.
#elif defined(__APPLE__) && (__cplusplus >= 201103L)
// NOTE: Does support c++11 std::atomic, but the compiler may or
// may not support GCC atomic intrinsics. So go ahead and use the
// std::atomic implementation.
#elif __cplusplus >= 201103L
// NOTE: Prefer to use the c++11 std::atomic.
#define ATOMIC_USE_CPP11_ATOMIC
#elif (defined(__clang__) && defined(__clang_major__) && (__clang_major__ > 5)) \
|| defined(__xlc__)
Expand Down Expand Up @@ -98,8 +96,6 @@
#elif defined(_MSC_VER)
#define ATOMIC_USE_MSVC_INTRINSICS
#include "atomic_msvc.h"
#elif __cplusplus >= 201103L
#define ATOMIC_USE_CPP11_ATOMIC
#else
#error Unsupported compiler / system.
#endif
Expand Down