commit e9eb74b39fc6afd6fba4acd43bfefebc5a30316a
parent e8b4aa2eb392514e1a9096479b1872ce7dc9265e
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date: Tue, 14 Sep 2021 21:29:07 +0200
ReducingParamQueue: fix stupid mistake
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/examples/common/reducing-param-queue.hxx b/examples/common/reducing-param-queue.hxx
@@ -25,7 +25,7 @@ void ReducingParamQueue<T>::setCapacity(size_t capacity) {
template<typename T>
void ReducingParamQueue<T>::set(clap_id id, const value_type& value) {
- _producer.load()->emplace(id, value);
+ _producer.load()->insert_or_assign(id, value);
}
template<typename T>
@@ -33,9 +33,10 @@ void ReducingParamQueue<T>::producerDone() {
if (_consumer)
return;
- _consumer.store(_producer.load());
- _producer.store(_free.load());
- _free.store(nullptr);
+ auto tmp = _producer.load();
+ _producer = _free.load();
+ _free = nullptr;
+ _consumer = tmp;
assert(_producer);
}