summaryrefslogtreecommitdiff
path: root/test/message.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-11-24 01:03:46 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-11-27 19:30:44 +0200
commitf88e756ceac9a442f12de5d2913047ed40b34542 (patch)
treefaf9efdb2af99f10cf4b6e47ea8f83f01f757823 /test/message.cpp
parent442f516c6215aa0bbdeec4c7f2d6c406521a92fd (diff)
libcamera: thread: Fix locking when moving object
When moving an Object to a Thread, messages posted for the object are move to the target thread's message queue. This requires locking the message queues of the current and target threads, as the target thread may (and is usually) running. The implementation is faulty as it locks the thread data instead of the message queue. This creates a race condition with a tiny but exploitable time window. The issue was noticed by the event-thread test rarely but reproducibly failing with the following assertion error: [1:39:33.850878042]FATAL default thread.cpp:440 assertion "data_ == receiver->thread()->data_" failed The issue only occurred when libcamera was compiled in release mode, further hinting of a race condition. Fixes: 01b930964acd ("libcamera: thread: Add a messaging passing API") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'test/message.cpp')
0 files changed, 0 insertions, 0 deletions