summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-05-21 16:42:23 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-05-24 12:27:07 +0300
commit6551bd39f047acaba269df17281b9b9c2a12581b (patch)
tree97c5fea65a7400f2975d7c819fed33e1add8cef7 /src
parent95cda2905c29e5af5002211e5672b20e8098cefe (diff)
libcamera: thread: Enforce dispatchMessages() call context with assert
The Thread::dispatchMessages() function is meant to be called from within the thread only. Catch incorrect usage with an ASSERT(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/thread.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libcamera/thread.cpp b/src/libcamera/thread.cpp
index 285b8083..bc1dcede 100644
--- a/src/libcamera/thread.cpp
+++ b/src/libcamera/thread.cpp
@@ -560,6 +560,8 @@ void Thread::removeMessages(Object *receiver)
*/
void Thread::dispatchMessages(Message::Type type)
{
+ ASSERT(data_ == ThreadData::current());
+
MutexLocker locker(data_->messages_.mutex_);
std::list<std::unique_ptr<Message>> &messages = data_->messages_.list_;