mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-01 16:05:07 +01:00
travis: Update xcode
Update to 10.2 (required for CTAD to work correctly)
This commit is contained in:
parent
8b7b6e9f74
commit
f2499953c0
@ -32,7 +32,7 @@ matrix:
|
||||
- os: osx
|
||||
env: NAME="macos build"
|
||||
sudo: false
|
||||
osx_image: xcode10
|
||||
osx_image: xcode10.2
|
||||
install: "./.travis/macos/deps.sh"
|
||||
script: "./.travis/macos/build.sh"
|
||||
after_success: "./.travis/macos/upload.sh"
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <atomic>
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <new>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
#include "common/common_types.h"
|
||||
@ -29,7 +30,7 @@ class RingBuffer {
|
||||
static_assert(capacity < std::numeric_limits<std::size_t>::max() / 2 / granularity);
|
||||
static_assert((capacity & (capacity - 1)) == 0, "capacity must be a power of two");
|
||||
// Ensure lock-free.
|
||||
static_assert(std::atomic<std::size_t>::is_always_lock_free);
|
||||
static_assert(std::atomic_size_t::is_always_lock_free);
|
||||
|
||||
public:
|
||||
/// Pushes slots into the ring buffer
|
||||
@ -100,10 +101,22 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
// It is important to align the below variables for performance reasons:
|
||||
// It is important to separate the below atomics for performance reasons:
|
||||
// Having them on the same cache-line would result in false-sharing between them.
|
||||
alignas(128) std::atomic<std::size_t> m_read_index{0};
|
||||
alignas(128) std::atomic<std::size_t> m_write_index{0};
|
||||
// TODO: Remove this ifdef whenever clang and GCC support
|
||||
// std::hardware_destructive_interference_size.
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1911
|
||||
static constexpr std::size_t padding_size =
|
||||
std::hardware_destructive_interference_size - sizeof(std::atomic_size_t);
|
||||
#else
|
||||
static constexpr std::size_t padding_size = 128 - sizeof(std::atomic_size_t);
|
||||
#endif
|
||||
|
||||
std::atomic_size_t m_read_index{0};
|
||||
char padding1[padding_size];
|
||||
|
||||
std::atomic_size_t m_write_index{0};
|
||||
char padding2[padding_size];
|
||||
|
||||
std::array<T, granularity * capacity> m_data;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user