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>
This commit is contained in:
Laurent Pinchart
2021-05-21 16:42:23 +03:00
parent 95cda2905c
commit 6551bd39f0

View File

@@ -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_;