summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-02-25 11:13:42 +0100
committerDavid Robillard <d@drobilla.net>2017-02-25 11:13:42 +0100
commit03fe0f02815be5754a2b95a168c35c0f29f49c51 (patch)
tree0a2710e0781b13a2d58a8312f1546fd83d92b95c
parent710c5095497fa355946f0032031703ddc5104b94 (diff)
downloadraul-03fe0f02815be5754a2b95a168c35c0f29f49c51.tar.gz
raul-03fe0f02815be5754a2b95a168c35c0f29f49c51.tar.bz2
raul-03fe0f02815be5754a2b95a168c35c0f29f49c51.zip
Reduce memory cleanup overhead
-rw-r--r--raul/Maid.hpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/raul/Maid.hpp b/raul/Maid.hpp
index 7f5a299..29b6473 100644
--- a/raul/Maid.hpp
+++ b/raul/Maid.hpp
@@ -102,13 +102,8 @@ public:
*/
inline void cleanup() {
// Atomically get the head of the disposed list
- Disposable* disposed;
- do {
- disposed = _disposed.load(std::memory_order_relaxed);
- } while (!_disposed.compare_exchange_weak(
- disposed, nullptr,
- std::memory_order_acquire,
- std::memory_order_relaxed));
+ Disposable* const disposed = _disposed.exchange(
+ nullptr, std::memory_order_acquire);
// Free the disposed list
for (Disposable* obj = disposed; obj;) {