[libcamera-devel] [PATCH 00/18] Object & Thread enhancements

Jacopo Mondi jacopo at jmondi.org
Thu Aug 15 11:59:01 CEST 2019


Hi Laurent,

I had only few minor comments and some naive questions on the series,
so please feel free to attach my R-b tag to all patches here, if
relevant.

Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>

Thanks
   j

On Mon, Aug 12, 2019 at 03:46:24PM +0300, Laurent Pinchart wrote:
> Hello everybody,
>
> This patch series extends the Object and Thread implementations in
> libcamera to improve thread affinity handling.
>
> This first patch is a simple cleanup.
>
> Object instances are associated with a thread, and the thread affinity
> can be changed with Object::moveToThread(). This moves pending messages
> for the object to the message queue of the new thread. Patch 02/18 fixes
> a bug in the implementation that forgot to wake up the event loop of the
> new thread, and patch 03/18 fixes a bug that prevented dispatching
> message to the main thread.
>
> The next three patches split the slot-related classes from signal.h
> (04/18), decouple them from the signal implementation (05/18) and use
> them to add a new asynchronous method invocation mechanism for the
> Object class (06/18). Patch 07/18 then adds a message to notify Object
> instances of thread move. The next two patches are new tests for those
> APIs.
>
> Patches 10/18 to 12/18 bind CameraManager, EventNotifier and Timer
> instances to threads by inheriting from the Object class. The
> EventNotifier and Timer classes now support being moved to a different
> thread with proper operation with the new thread's event loop. The next
> two patches add new tests for those operations.
>
> Patch 15/18 adds a parent-child hierarchy in the Object class, to
> simplify moving objects to threads. Patch 16/18 supports this by adding
> a parent argument to the constructor of various classes. Patch 17/18
> extends the object test to cover the parent-child relationships, and
> patch 18/18 shows how they can simplify code.
>
> Laurent Pinchart (18):
>   libcamera: object: Make message() method protected
>   libcamera: thread: Wake up target thread when moving objects
>   libcamera: thread: Support dispatching messages to main thread
>   libcamera: signal: Split Slot implementation to reusable classes
>   libcamera: bound_method: Decouple from Signal implementation
>   libcamera: object: Add an asynchronous method invocation method
>   libcamera: object: Notify objects of thread move
>   test: Add Object::invokeMethod() test
>   test: Add Object class thread affinity test
>   libcamera: camera_manager: Bind CameraManager to threads
>   libcamera: event_notifier: Bind event notifiers to threads
>   libcamera: timer: Bind timers to threads
>   test: Add EventNotifier thread move test
>   test: Add Timer thread move test
>   libcamera: object: Create parent-child relationships
>   libcamera: Add parent argument to constructors of Object-derived
>     classes
>   test: object: Extend object test to verify parent-child relationships
>   test: Simplify tests with parent-child relationships
>
>  Documentation/Doxyfile.in               |  10 +-
>  include/libcamera/bound_method.h        | 130 +++++++++++++++++++
>  include/libcamera/camera_manager.h      |   4 +-
>  include/libcamera/event_notifier.h      |  10 +-
>  include/libcamera/meson.build           |   1 +
>  include/libcamera/object.h              |  32 ++++-
>  include/libcamera/signal.h              | 151 +++-------------------
>  include/libcamera/timer.h               |  13 +-
>  src/libcamera/bound_method.cpp          |  27 ++++
>  src/libcamera/camera_manager.cpp        |   4 +-
>  src/libcamera/event_dispatcher_poll.cpp |   3 +
>  src/libcamera/event_notifier.cpp        |  22 +++-
>  src/libcamera/include/message.h         |  22 ++--
>  src/libcamera/include/thread.h          |   5 +-
>  src/libcamera/meson.build               |   1 +
>  src/libcamera/message.cpp               |  50 ++++++--
>  src/libcamera/object.cpp                | 120 +++++++++++++++---
>  src/libcamera/signal.cpp                |  23 ----
>  src/libcamera/thread.cpp                |  26 +++-
>  src/libcamera/timer.cpp                 |  33 ++++-
>  test/event-thread.cpp                   | 106 ++++++++++++++++
>  test/meson.build                        |   4 +
>  test/object-invoke.cpp                  | 137 ++++++++++++++++++++
>  test/object.cpp                         | 158 ++++++++++++++++++++++++
>  test/timer-thread.cpp                   |  72 +++++++++++
>  25 files changed, 948 insertions(+), 216 deletions(-)
>  create mode 100644 include/libcamera/bound_method.h
>  create mode 100644 src/libcamera/bound_method.cpp
>  create mode 100644 test/event-thread.cpp
>  create mode 100644 test/object-invoke.cpp
>  create mode 100644 test/object.cpp
>  create mode 100644 test/timer-thread.cpp
>
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20190815/fa1b0053/attachment-0001.sig>


More information about the libcamera-devel mailing list