[libcamera-devel] [PATCH 2/4] libcamera: thread: Enforce dispatchMessages() call context with assert

Hirokazu Honda hiroh at chromium.org
Mon May 24 07:39:20 CEST 2021


Hi Laurent, thank you for the patch.

On Mon, May 24, 2021 at 11:43 AM Umang Jain <umang.jain at ideasonboard.com>
wrote:

> Hi Laurent,
>
> Thanks for the patch
>
> On 5/23/21 8:01 AM, Laurent Pinchart wrote:
> > 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 at ideasonboard.com>
> Reviewed-by: Umang Jain <umang.jain at ideasonboard.com>
>

Reviewed-by: Hirokazu Honda <hiroh at chromium.org>


> > ---
> >   src/libcamera/thread.cpp | 2 ++
> >   1 file changed, 2 insertions(+)
> >
> > diff --git a/src/libcamera/thread.cpp b/src/libcamera/thread.cpp
> > index 285b808332e8..bc1dcedea0d1 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_;
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20210524/06c1ed2e/attachment.htm>


More information about the libcamera-devel mailing list