libcamera/src
Laurent Pinchart f422624d9c libcamera: thread: Ensure deferred deletion of all objects before stopping
Objects can be scheduled for deletion with Object::deleteLater(), which
queues a deferred deletion to the thread's event loop. As the
deleteLater() function is meant to be called from a different thread,
this may race with thread termination, and deferred deletions queued
just before calling Thread::exit() may not be processed by the event
loop. Make sure they get processed when finishing the thread, before
stopping.

This eliminates the race condition that occurs when calling
Object::deleteLater() followed by Thread::exit() from the same thread.
Calling deleteLater() from neither the thread the object is bound to or
the thread calling Thread::exit() is still inherently racy.

The change fixes a failure in the object-delete unit test.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
2024-01-25 02:39:05 +02:00
..
android android: camera_device: Fix requestedStream handling 2023-09-21 12:44:09 +02:00
apps apps: common: dng_writer: Add a default case for switch-case on a modulo 2024-01-24 17:29:24 +02:00
gstreamer gstreamer: Add meson devenv support 2024-01-23 02:21:39 +02:00
ipa libipa: camera_sensor_helper: Mark createInstance() with override 2024-01-12 12:49:20 +02:00
libcamera libcamera: thread: Ensure deferred deletion of all objects before stopping 2024-01-25 02:39:05 +02:00
py meson: Tag all installed files 2023-12-07 01:43:17 +02:00
v4l2 meson: Tag all installed files 2023-12-07 01:43:17 +02:00
meson.build v4l2: Move the v4l2 compat layer to libexec/libcamera 2023-05-04 20:05:02 +01:00