libcamera: base: thread: Use acquire memo. when reading event dispatcher
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 <barnabas.pocze@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
@@ -244,7 +244,7 @@ Thread::Thread(std::string name)
|
||||
|
||||
Thread::~Thread()
|
||||
{
|
||||
delete data_->dispatcher_.load(std::memory_order_relaxed);
|
||||
delete data_->dispatcher_.load(std::memory_order_acquire);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -379,7 +379,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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user