From patchwork Fri Jul 31 18:14:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 9118 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 9C514BD86F for ; Fri, 31 Jul 2020 18:14:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EA1CA61EAB; Fri, 31 Jul 2020 20:14:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="AQkQEZFp"; dkim-atps=neutral Received: from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7D8F460396 for ; Fri, 31 Jul 2020 20:14:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com; h=from:subject:mime-version:to:cc:content-transfer-encoding: content-type; s=s1; bh=VCAjHIA//k9VRNDgElE1wegAjb0Yl2puPK1eft2QrTY=; b=AQkQEZFpYNn86NrBdYEBntIYLrDikOu3vnNtPZOlvQQEN8S9B06Y+idcV7Iy75g2Z7a6 HdzM+c4NIvpF8bsVPIqxZx07P2RZ9xwkqBLMyGf/20ny1e+zz58/0Rhg0tp8MgBf7rdVM7 RC3iBLUEonEx7Xtd8hgdzMQU4cTaIkHtI= Received: by filterdrecv-p3iad2-d8cc6d457-gjvhw with SMTP id filterdrecv-p3iad2-d8cc6d457-gjvhw-19-5F245F75-6D 2020-07-31 18:14:13.921725941 +0000 UTC m=+173152.753361242 Received: from mail.uajain.com (unknown) by ismtpd0001p1maa1.sendgrid.net (SG) with ESMTP id 8hX03oOORcGER8vZ8btOEg for ; Fri, 31 Jul 2020 18:14:13.218 +0000 (UTC) From: Umang Jain Date: Fri, 31 Jul 2020 18:14:13 +0000 (UTC) Message-Id: <20200731181410.99892-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcZj5z9XHfwy1Ge6f/0y1LY2Nhbyg1xVAwe2IdfC2V0bLXfIJMylEdXO/1Y/kfKsYz7x4abhCAJDvRYpkd1LQLLJ0LsiIKXKsXIgz8Qrj0ZyvQfjIOWEAVvYXESPljiirhLBmZW7CE4b6kR5lPuedTKN+eiBQSAcWXuigt18DAL0126gjIL/biYvCZFGNMswWlGYYDTxPdgK1T5t7vMKf93w== To: libcamera-devel@lists.libcamera.org Subject: [libcamera-devel] [PATCH v4 0/4] libcamera: object: Add deleteLater() support X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Changes in v4: - Split out object-delete unit test from 2/3 in v3. The test is modified to also check for multiple deleteLater() calls. - Fix a bug in dispatchMessages() to erase list entries for empty messages (which was not happening in v3). - Indentation fixes. Changes in v3: - Address review for 1/3. dispatchMessages() message loop changed to support handling dispatching of all or per type messages. Changes in v2: - Extend Thread::setEventDispatcher to selectively deliver messages - This will help if we want to explicitly deliver some messages if event loop is not running. - Include Object::deleteLater() unit test - One \todo here as one case pending to cover; multiple deleteLater() should only delete the object once. - Review comments (mostly documentation fixes). Umang Jain (4): libcamera: thread: Support selective message dispatch to thread libcamera: object: Add deleteLater() support tests: Add a test case for the Object::deleteLater() API, to verify libcamera: camera: Ensure deletion via deleteLater() include/libcamera/camera.h | 3 +- include/libcamera/internal/message.h | 1 + include/libcamera/internal/thread.h | 3 +- include/libcamera/object.h | 2 + src/libcamera/camera.cpp | 2 +- src/libcamera/camera_manager.cpp | 6 +- src/libcamera/message.cpp | 2 + src/libcamera/object.cpp | 48 ++++++++++++++ src/libcamera/thread.cpp | 35 +++++++--- test/meson.build | 1 + test/object-delete.cpp | 97 ++++++++++++++++++++++++++++ 11 files changed, 187 insertions(+), 13 deletions(-) create mode 100644 test/object-delete.cpp