{"id":19450,"url":"https://patchwork.libcamera.org/api/1.1/patches/19450/?format=json","web_url":"https://patchwork.libcamera.org/patch/19450/","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":"<20240123011249.22716-3-laurent.pinchart@ideasonboard.com>","date":"2024-01-23T01:12:39","name":"[v2,02/12] libcamera: signal: Replace object.h inclusion with forward declatation","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"ad1acf607c34be3ae91e2b9ee74697560bfb8032","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19450/mbox/","series":[{"id":4157,"url":"https://patchwork.libcamera.org/api/1.1/series/4157/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4157","date":"2024-01-23T01:12:37","name":"libcamera: Hardening against thread race conditions","version":2,"mbox":"https://patchwork.libcamera.org/series/4157/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19450/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19450/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 4F750C32BC\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Jan 2024 01:12:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7CF2C6294F;\n\tTue, 23 Jan 2024 02:12:52 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 28D936294A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Jan 2024 02:12:49 +0100 (CET)","from pendragon.ideasonboard.com (89-27-53-110.bb.dnainternet.fi\n\t[89.27.53.110])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 666C61593;\n\tTue, 23 Jan 2024 02:11:35 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Um+tJSxE\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1705972295;\n\tbh=WizYAfAkOLHPMkVocllD4Y1dKtYd2x2CsN/2zqXAyHA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Um+tJSxENxapXw1uh0zwVxHCwEXoUeFEZATdAUFlCIYO450jXnGri8HoCAMYe0hXm\n\tXfFC7JDGgBjEsqpeVuTbOSSZLBX+eMEJLvfn7mq6GaZB7cyMqP9//kBFjoD1GZBsjE\n\tGssTrFqQXAfHlA0eIK6ct0kaZuK97BFLfpRyT8sc=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH v2 02/12] libcamera: signal: Replace object.h inclusion with\n\tforward declatation","Date":"Tue, 23 Jan 2024 03:12:39 +0200","Message-ID":"<20240123011249.22716-3-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20240123011249.22716-1-laurent.pinchart@ideasonboard.com>","References":"<20240123011249.22716-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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":"The signal.h header doesn't need to include object.h. Replace it with a\nforward declaration, and instead include object.h in source files that\nrequire it. It can speed up compilation a little bit, but more\nimportantly avoids unintended dependencies from the Signal class to the\nObject class to be added later as the compiler will catch them.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n---\nChanges since v1:\n\n- Fix typo in commit message\n---\n include/libcamera/base/signal.h                                | 3 ++-\n src/libcamera/base/bound_method.cpp                            | 1 +\n src/libcamera/base/signal.cpp                                  | 1 +\n src/libcamera/base/thread.cpp                                  | 1 +\n test/event-thread.cpp                                          | 1 +\n test/ipa/ipa_interface_test.cpp                                | 1 +\n test/message.cpp                                               | 1 +\n test/signal-threads.cpp                                        | 1 +\n test/timer-thread.cpp                                          | 1 +\n .../ipc/generators/libcamera_templates/module_ipa_proxy.h.tmpl | 1 +\n 10 files changed, 11 insertions(+), 1 deletion(-)","diff":"diff --git a/include/libcamera/base/signal.h b/include/libcamera/base/signal.h\nindex 841e4b4ca15c..444997b4525d 100644\n--- a/include/libcamera/base/signal.h\n+++ b/include/libcamera/base/signal.h\n@@ -13,10 +13,11 @@\n #include <vector>\n \n #include <libcamera/base/bound_method.h>\n-#include <libcamera/base/object.h>\n \n namespace libcamera {\n \n+class Object;\n+\n class SignalBase\n {\n public:\ndiff --git a/src/libcamera/base/bound_method.cpp b/src/libcamera/base/bound_method.cpp\nindex 3ecec51c4b75..c83d623f107d 100644\n--- a/src/libcamera/base/bound_method.cpp\n+++ b/src/libcamera/base/bound_method.cpp\n@@ -7,6 +7,7 @@\n \n #include <libcamera/base/bound_method.h>\n #include <libcamera/base/message.h>\n+#include <libcamera/base/object.h>\n #include <libcamera/base/semaphore.h>\n #include <libcamera/base/thread.h>\n \ndiff --git a/src/libcamera/base/signal.cpp b/src/libcamera/base/signal.cpp\nindex 02290ad779ee..f1018b37038c 100644\n--- a/src/libcamera/base/signal.cpp\n+++ b/src/libcamera/base/signal.cpp\n@@ -8,6 +8,7 @@\n #include <libcamera/base/signal.h>\n \n #include <libcamera/base/mutex.h>\n+#include <libcamera/base/object.h>\n \n /**\n  * \\file base/signal.h\ndiff --git a/src/libcamera/base/thread.cpp b/src/libcamera/base/thread.cpp\nindex b96951ac19ba..75693c92a0b1 100644\n--- a/src/libcamera/base/thread.cpp\n+++ b/src/libcamera/base/thread.cpp\n@@ -18,6 +18,7 @@\n #include <libcamera/base/log.h>\n #include <libcamera/base/message.h>\n #include <libcamera/base/mutex.h>\n+#include <libcamera/base/object.h>\n \n /**\n  * \\page thread Thread Support\ndiff --git a/test/event-thread.cpp b/test/event-thread.cpp\nindex ef8a52c3de55..88a8c07ef9f0 100644\n--- a/test/event-thread.cpp\n+++ b/test/event-thread.cpp\n@@ -11,6 +11,7 @@\n #include <unistd.h>\n \n #include <libcamera/base/event_notifier.h>\n+#include <libcamera/base/object.h>\n #include <libcamera/base/thread.h>\n #include <libcamera/base/timer.h>\n \ndiff --git a/test/ipa/ipa_interface_test.cpp b/test/ipa/ipa_interface_test.cpp\nindex 051ef96e7ed2..56f3cd6d57ba 100644\n--- a/test/ipa/ipa_interface_test.cpp\n+++ b/test/ipa/ipa_interface_test.cpp\n@@ -16,6 +16,7 @@\n \n #include <libcamera/base/event_dispatcher.h>\n #include <libcamera/base/event_notifier.h>\n+#include <libcamera/base/object.h>\n #include <libcamera/base/thread.h>\n #include <libcamera/base/timer.h>\n \ndiff --git a/test/message.cpp b/test/message.cpp\nindex d148a13d6c7a..0e76f323e3b9 100644\n--- a/test/message.cpp\n+++ b/test/message.cpp\n@@ -11,6 +11,7 @@\n #include <thread>\n \n #include <libcamera/base/message.h>\n+#include <libcamera/base/object.h>\n #include <libcamera/base/thread.h>\n \n #include \"test.h\"\ndiff --git a/test/signal-threads.cpp b/test/signal-threads.cpp\nindex d5e2eb662df2..8c550eb014d8 100644\n--- a/test/signal-threads.cpp\n+++ b/test/signal-threads.cpp\n@@ -10,6 +10,7 @@\n #include <thread>\n \n #include <libcamera/base/message.h>\n+#include <libcamera/base/object.h>\n #include <libcamera/base/thread.h>\n #include <libcamera/base/utils.h>\n \ndiff --git a/test/timer-thread.cpp b/test/timer-thread.cpp\nindex 618217538779..0bcd0d8ce194 100644\n--- a/test/timer-thread.cpp\n+++ b/test/timer-thread.cpp\n@@ -9,6 +9,7 @@\n #include <iostream>\n \n #include <libcamera/base/event_dispatcher.h>\n+#include <libcamera/base/object.h>\n #include <libcamera/base/thread.h>\n #include <libcamera/base/timer.h>\n \ndiff --git a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.h.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.h.tmpl\nindex ed270f5cd49c..6e823598930e 100644\n--- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.h.tmpl\n+++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.h.tmpl\n@@ -18,6 +18,7 @@\n #include <libcamera/ipa/ipa_interface.h>\n #include <libcamera/ipa/{{module_name}}_ipa_interface.h>\n \n+#include <libcamera/base/object.h>\n #include <libcamera/base/thread.h>\n \n #include \"libcamera/internal/control_serializer.h\"\n","prefixes":["v2","02/12"]}