libcamera: base: thread: eventDispatcher(): Not thread safe

The function is not actually thread safe contrary to its documentation.
Since it is currently not used in an unsafe context, simply remove the
mention of thread safety from the documentation.

The variable must still remain atomic because it is accessed internally
from different threads, e.g. `Thread::postMessage()`.

Also add an assertion to enforce this.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Barnabás Pőcze
2025-08-15 12:11:32 +02:00
parent af43c2f945
commit 1bd66f54a6

View File

@@ -512,12 +512,12 @@ pid_t Thread::currentId()
* This function retrieves the internal event dispatcher for the thread. The
* returned event dispatcher is valid until the thread is destroyed.
*
* \context This function is \threadsafe.
*
* \return Pointer to the event dispatcher
*/
EventDispatcher *Thread::eventDispatcher()
{
ASSERT(data_ == ThreadData::current());
if (!data_->dispatcher_.load(std::memory_order_relaxed))
data_->dispatcher_.store(new EventDispatcherPoll(),
std::memory_order_release);