diff options
author | Umang Jain <email@uajain.com> | 2020-07-31 18:14:15 +0000 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-07-31 23:33:32 +0300 |
commit | 9558886f7a852155e6a911afa81df6e77b0aa68d (patch) | |
tree | 979653004f046f97fb7952e4052d2b68376cae93 /test/object-delete.cpp | |
parent | 3fe7c1cdb4e14aa4da0681103a33912f962c5cc8 (diff) |
libcamera: object: Add deleteLater() support
This commit adds support to schedule the deletion of an Object to the
thread it is bound to (similar to [1]). An Object getting destroyed
by a different thread is considered as a violation as per the
libcamera threading model.
This will be useful for an Object where its ownership is shared via
shared pointers in different threads. If the thread which drops the
last reference of the Object is a different thread, the destructors
get called in that particular thread, not the one Object is bound to.
Hence, in order to resolve this kind of situation, the creation of
shared pointer can be accompanied by a custom deleter which in turns
use deleteLater() to ensure the Object is destroyed in its own thread.
[1] https://doc.qt.io/qt-5/qobject.html#deleteLater
Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'test/object-delete.cpp')
0 files changed, 0 insertions, 0 deletions