From patchwork Mon Oct 28 10:49:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2275 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0D3A760180 for ; Mon, 28 Oct 2019 11:49:26 +0100 (CET) Received: from pendragon.ideasonboard.com (unknown [91.217.168.176]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B0628325 for ; Mon, 28 Oct 2019 11:49:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1572259765; bh=bZ0U1F0cR4aWfYQjFJGt08aQHdMjbaUgrBZtrHOjRh4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=TknU/cwt/GOHT40MaWaYuKFEPaZ9RuGU2UQO4VntN6nZ6NQG7nVjW9DrLjtGTQLCw hYO/VXPLN2LChVC7qNxfK1MeH7RS0+mjH5b8bW5YjEC0ycnMZjXMUp2+2+glH6DnC5 NM06wijv+J/mGF4xpRuC8BDIkFK+Vy9Q06vgqPNA= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Oct 2019 12:49:06 +0200 Message-Id: <20191028104913.14985-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191028104913.14985-1-laurent.pinchart@ideasonboard.com> References: <20191028104913.14985-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/9] libcamera: bound_method: Define connection type for method invocation 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: , X-List-Received-Date: Mon, 28 Oct 2019 10:49:26 -0000 From: Jacopo Mondi Define an enumeration of connection types to describe the delivery method of signals and method invocation. Signed-off-by: Jacopo Mondi Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- Documentation/Doxyfile.in | 4 +--- include/libcamera/bound_method.h | 7 +++++++ src/libcamera/bound_method.cpp | 34 ++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in index 5237cf60854f..24babfd8b366 100644 --- a/Documentation/Doxyfile.in +++ b/Documentation/Doxyfile.in @@ -837,9 +837,7 @@ RECURSIVE = YES # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = @TOP_SRCDIR@/include/libcamera/bound_method.h \ - @TOP_SRCDIR@/src/libcamera/bound_method.cpp \ - @TOP_SRCDIR@/src/libcamera/device_enumerator_sysfs.cpp \ +EXCLUDE = @TOP_SRCDIR@/src/libcamera/device_enumerator_sysfs.cpp \ @TOP_SRCDIR@/src/libcamera/device_enumerator_udev.cpp \ @TOP_SRCDIR@/src/libcamera/include/device_enumerator_sysfs.h \ @TOP_SRCDIR@/src/libcamera/include/device_enumerator_udev.h \ diff --git a/include/libcamera/bound_method.h b/include/libcamera/bound_method.h index 8ebaadbec887..e1524c917e4b 100644 --- a/include/libcamera/bound_method.h +++ b/include/libcamera/bound_method.h @@ -14,6 +14,13 @@ namespace libcamera { class Object; +enum ConnectionType { + ConnectionTypeAuto, + ConnectionTypeDirect, + ConnectionTypeQueued, + ConnectionTypeBlocking, +}; + class BoundMethodBase { public: diff --git a/src/libcamera/bound_method.cpp b/src/libcamera/bound_method.cpp index d89f84c03f4d..ab6ecd9423d1 100644 --- a/src/libcamera/bound_method.cpp +++ b/src/libcamera/bound_method.cpp @@ -11,8 +11,42 @@ #include "thread.h" #include "utils.h" +/** + * \file bound_method.h + * \brief Method bind and invocation + */ + namespace libcamera { +/** + * \enum ConnectionType + * \brief Connection type for asynchronous communication + * + * This enumeration describes the possible types of asynchronous communication + * between a sender and a receiver. It applies to Signal::emit() and + * Object::invokeMethod(). + * + * \var ConnectionType::ConnectionTypeAuto + * \brief If the sender and the receiver live in the same thread, + * ConnectionTypeDirect is used. Otherwise ConnectionTypeQueued is used. + * + * \var ConnectionType::ConnectionTypeDirect + * \brief The receiver is invoked immediately and synchronously in the sender's + * thread. + * + * \var ConnectionType::ConnectionTypeQueued + * \brief The receiver is invoked asynchronously in its thread when control + * returns to the thread's event loop. The sender proceeds without waiting for + * the invocation to complete. + * + * \var ConnectionType::ConnectionTypeBlocking + * \brief The receiver is invoked asynchronously in its thread when control + * returns to the thread's event loop. The sender blocks until the receiver + * signals the completion of the invocation. This connection type shall not be + * used when the sender and receiver live in the same thread, otherwise + * deadlock will occur. + */ + void BoundMethodBase::activatePack(void *pack) { if (Thread::current() == object_->thread()) {