{"id":14397,"url":"https://patchwork.libcamera.org/api/1.1/patches/14397/?format=json","web_url":"https://patchwork.libcamera.org/patch/14397/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20211028111520.256612-3-jacopo@jmondi.org>","date":"2021-10-28T11:15:12","name":"[libcamera-devel,02/10] libcamera: event_notifier: Add 'enable' constructor parameter","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"fcd1f719081b7bc0e62234d56c61b66bf172302e","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14397/mbox/","series":[{"id":2674,"url":"https://patchwork.libcamera.org/api/1.1/series/2674/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2674","date":"2021-10-28T11:15:10","name":"libcamera: Introduce Fence support","version":1,"mbox":"https://patchwork.libcamera.org/series/2674/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14397/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14397/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C47A6BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 28 Oct 2021 11:14:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 503AB60253;\n\tThu, 28 Oct 2021 13:14:42 +0200 (CEST)","from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 27FBF600BA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Oct 2021 13:14:38 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay9-d.mail.gandi.net (Postfix) with ESMTPSA id B186DFF80E;\n\tThu, 28 Oct 2021 11:14:37 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 28 Oct 2021 13:15:12 +0200","Message-Id":"<20211028111520.256612-3-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.33.1","In-Reply-To":"<20211028111520.256612-1-jacopo@jmondi.org>","References":"<20211028111520.256612-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 02/10] libcamera: event_notifier: Add\n\t'enable' constructor parameter","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add an 'enable' parameter to the EventNotifier class constructor.\n\nCurrently an EvenNotifier is enabled as soon as it is constructed.\nAdd an optional parameter to the class constructor to allow post-poning\nthe notifier activation.\n\nAs the 'enable' parameter has a default value of true, existing users\nof the class should not be updated.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/base/event_notifier.h |  2 +-\n src/libcamera/base/event_notifier.cpp   | 12 ++++++++----\n 2 files changed, 9 insertions(+), 5 deletions(-)","diff":"diff --git a/include/libcamera/base/event_notifier.h b/include/libcamera/base/event_notifier.h\nindex f7722a32ef55..4d373a5290cc 100644\n--- a/include/libcamera/base/event_notifier.h\n+++ b/include/libcamera/base/event_notifier.h\n@@ -25,7 +25,7 @@ public:\n \t\tException,\n \t};\n \n-\tEventNotifier(int fd, Type type, Object *parent = nullptr);\n+\tEventNotifier(int fd, Type type, Object *parent = nullptr, bool enable = true);\n \tvirtual ~EventNotifier();\n \n \tType type() const { return type_; }\ndiff --git a/src/libcamera/base/event_notifier.cpp b/src/libcamera/base/event_notifier.cpp\nindex fd93c0878c6f..40428cf24a50 100644\n--- a/src/libcamera/base/event_notifier.cpp\n+++ b/src/libcamera/base/event_notifier.cpp\n@@ -26,8 +26,11 @@ namespace libcamera {\n  *\n  * The EventNotifier models a file descriptor event source that can be\n  * monitored. It is created with the file descriptor to be monitored and the\n- * type of event, and is enabled by default. It will emit the \\ref activated\n- * signal whenever an event of the monitored type occurs on the file descriptor.\n+ * type of event. It will emit the \\ref activated signal whenever an event of\n+ * the monitored type occurs on the file descriptor.\n+ *\n+ * An EventNotifier is enabled by default when created, unless otherwise\n+ * specified through the optional 'enable' constructor parameter.\n  *\n  * Supported type of events are EventNotifier::Read, EventNotifier::Write and\n  * EventNotifier::Exception. The type is specified when constructing the\n@@ -62,11 +65,12 @@ namespace libcamera {\n  * \\param[in] fd The file descriptor to monitor\n  * \\param[in] type The event type to monitor\n  * \\param[in] parent The parent Object\n+ * \\param[in] enable Notifier enable flag\n  */\n-EventNotifier::EventNotifier(int fd, Type type, Object *parent)\n+EventNotifier::EventNotifier(int fd, Type type, Object *parent, bool enable)\n \t: Object(parent), fd_(fd), type_(type), enabled_(false)\n {\n-\tsetEnabled(true);\n+\tsetEnabled(enable);\n }\n \n EventNotifier::~EventNotifier()\n","prefixes":["libcamera-devel","02/10"]}