@@ -238,7 +238,7 @@ Thread::Thread()
Thread::~Thread()
{
- delete data_->dispatcher_.load(std::memory_order_relaxed);
+ delete data_->dispatcher_.load(std::memory_order_acquire);
delete data_;
}
@@ -371,7 +371,7 @@ void Thread::exit(int code)
data_->exitCode_ = code;
data_->exit_.store(true, std::memory_order_release);
- EventDispatcher *dispatcher = data_->dispatcher_.load(std::memory_order_relaxed);
+ EventDispatcher *dispatcher = data_->dispatcher_.load(std::memory_order_acquire);
if (!dispatcher)
return;
Use `std::memory_order_acquire` everywhere the dispatcher is loaded to guarantee synchronization with the release-store that places the pointer there. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> --- src/libcamera/base/thread.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)