summaryrefslogtreecommitdiffstats
path: root/raul/RingBuffer.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-09-20 15:26:45 -0400
committerDavid Robillard <d@drobilla.net>2016-09-26 13:09:10 -0400
commitf8bf77d3c3b77830aedafb9ebb5cdadfea7ed07a (patch)
tree4b191728aa88b9e83080b07f4e391a62229168e9 /raul/RingBuffer.hpp
parent537debda2bba0f97734602a95d412569fb607efb (diff)
downloadraul-f8bf77d3c3b77830aedafb9ebb5cdadfea7ed07a.tar.gz
raul-f8bf77d3c3b77830aedafb9ebb5cdadfea7ed07a.tar.bz2
raul-f8bf77d3c3b77830aedafb9ebb5cdadfea7ed07a.zip
Remove features now provided by C++11
Diffstat (limited to 'raul/RingBuffer.hpp')
-rw-r--r--raul/RingBuffer.hpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/raul/RingBuffer.hpp b/raul/RingBuffer.hpp
index eb86036..1ec5e4e 100644
--- a/raul/RingBuffer.hpp
+++ b/raul/RingBuffer.hpp
@@ -18,12 +18,12 @@
#define RAUL_RING_BUFFER_HPP
#include <assert.h>
+#include <atomic>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "raul/Noncopyable.hpp"
-#include "raul/barrier.hpp"
namespace Raul {
@@ -103,7 +103,7 @@ public:
const uint32_t w = _write_head;
if (peek_internal(r, w, size, dst)) {
- Raul::barrier();
+ std::atomic_thread_fence(std::memory_order_acquire);
_read_head = (r + size) & _size_mask;
return size;
} else {
@@ -121,7 +121,7 @@ public:
return 0;
}
- Raul::barrier();
+ std::atomic_thread_fence(std::memory_order_acquire);
_read_head = (r + size) & _size_mask;
return size;
}
@@ -138,7 +138,7 @@ public:
if (w + size <= _size) {
memcpy(&_buf[w], src, size);
- Raul::barrier();
+ std::atomic_thread_fence(std::memory_order_release);
_write_head = (w + size) & _size_mask;
} else {
const uint32_t this_size = _size - w;
@@ -146,7 +146,7 @@ public:
assert(w + this_size <= _size);
memcpy(&_buf[w], src, this_size);
memcpy(&_buf[0], (const char*)src + this_size, size - this_size);
- Raul::barrier();
+ std::atomic_thread_fence(std::memory_order_release);
_write_head = size - this_size;
}