Patch Detail
Show a patch.
GET /api/patches/2723/?format=api
{ "id": 2723, "url": "https://patchwork.libcamera.org/api/patches/2723/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2723/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20200122205723.8865-8-laurent.pinchart@ideasonboard.com>", "date": "2020-01-22T20:57:17", "name": "[libcamera-devel,v2,07/13] libcamera: Document thread-safety attributes of core classes", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "298892e1d163a74ecb93d3882ec2f3013777b31e", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/2723/mbox/", "series": [ { "id": 645, "url": "https://patchwork.libcamera.org/api/series/645/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=645", "date": "2020-01-22T20:57:10", "name": "Initial libcamera threading model", "version": 2, "mbox": "https://patchwork.libcamera.org/series/645/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2723/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2723/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "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 2B04B60890\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jan 2020 21:57:45 +0100 (CET)", "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BE15B2F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jan 2020 21:57:44 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1579726664;\n\tbh=XEGGuOsYttLglPAufH/U5dDguG8C6OG9/6uQKqC3CmM=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=HpqkYBd+XKDKR0fvohjsaGZDVA68e4ZU09teLY5xW99IK9aq1gQ8UCy3giwH8Q1YO\n\tgAetIj2GsdG2KF99X9pCJ0vL96tbBh24YVUNOW8drKSrS85GVGXaxGk61JhkCaC1hb\n\t6vDWDBq+2EoINhODy9V+ECooB21Th56ldME3jdEQ=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 22 Jan 2020 22:57:17 +0200", "Message-Id": "<20200122205723.8865-8-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.24.1", "In-Reply-To": "<20200122205723.8865-1-laurent.pinchart@ideasonboard.com>", "References": "<20200122205723.8865-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 07/13] libcamera: Document\n\tthread-safety attributes of core classes", "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>", "X-List-Received-Date": "Wed, 22 Jan 2020 20:57:47 -0000" }, "content": "Define the thread-safety attributes of the classes and methods that are\neither thread-safe or thread-bound. The CameraManager, Camera and\nPipelineHandler will be addressed separately.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/device_enumerator.cpp | 2 ++\n src/libcamera/event_notifier.cpp | 2 ++\n src/libcamera/ipc_unixsocket.cpp | 2 ++\n src/libcamera/object.cpp | 10 ++++++++--\n src/libcamera/thread.cpp | 2 ++\n src/libcamera/timer.cpp | 20 ++++++++++++--------\n src/libcamera/v4l2_videodevice.cpp | 2 ++\n 7 files changed, 30 insertions(+), 10 deletions(-)", "diff": "diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp\nindex a8b5c90f5a5d..64cdc132308a 100644\n--- a/src/libcamera/device_enumerator.cpp\n+++ b/src/libcamera/device_enumerator.cpp\n@@ -190,6 +190,8 @@ DeviceEnumerator::~DeviceEnumerator()\n * with a warning message logged, without returning an error. Only errors that\n * prevent enumeration altogether shall be fatal.\n *\n+ * \\context This function is \\threadbound.\n+ *\n * \\return 0 on success or a negative error code otherwise\n */\n \ndiff --git a/src/libcamera/event_notifier.cpp b/src/libcamera/event_notifier.cpp\nindex 4326b0b413e2..a9be686f79ae 100644\n--- a/src/libcamera/event_notifier.cpp\n+++ b/src/libcamera/event_notifier.cpp\n@@ -99,6 +99,8 @@ EventNotifier::~EventNotifier()\n *\n * This function enables or disables the notifier. A disabled notifier ignores\n * events and does not emit the \\ref activated signal.\n+ *\n+ * \\context This function is \\threadbound.\n */\n void EventNotifier::setEnabled(bool enable)\n {\ndiff --git a/src/libcamera/ipc_unixsocket.cpp b/src/libcamera/ipc_unixsocket.cpp\nindex eb1a50239188..6e5cab894a93 100644\n--- a/src/libcamera/ipc_unixsocket.cpp\n+++ b/src/libcamera/ipc_unixsocket.cpp\n@@ -62,6 +62,8 @@ LOG_DEFINE_CATEGORY(IPCUnixSocket)\n * communication method. The remote side then instantiates a socket, and binds\n * it to the other side by passing the file descriptor to bind(). At that point\n * the channel is operation and communication is bidirectional and symmmetrical.\n+ *\n+ * \\context This class is \\threadbound.\n */\n \n IPCUnixSocket::IPCUnixSocket()\ndiff --git a/src/libcamera/object.cpp b/src/libcamera/object.cpp\nindex f2a8be172547..99c3bf9a709b 100644\n--- a/src/libcamera/object.cpp\n+++ b/src/libcamera/object.cpp\n@@ -110,6 +110,8 @@ Object::~Object()\n * Messages are delivered through the thread's event loop. If the thread is not\n * running its event loop the message will not be delivered until the event\n * loop gets started.\n+ *\n+ * \\context This function is \\threadsafe.\n */\n void Object::postMessage(std::unique_ptr<Message> msg)\n {\n@@ -162,6 +164,8 @@ void Object::message(Message *msg)\n * are passed untouched. The caller shall ensure that any pointer argument\n * remains valid until the method is invoked.\n *\n+ * \\context This function is \\threadsafe.\n+ *\n * \\return For connection types ConnectionTypeDirect and\n * ConnectionTypeBlocking, return the return value of the invoked method. For\n * connection type ConnectionTypeQueued, return a default-constructed R value.\n@@ -170,6 +174,7 @@ void Object::message(Message *msg)\n /**\n * \\fn Object::thread()\n * \\brief Retrieve the thread the object is bound to\n+ * \\context This function is \\threadsafe.\n * \\return The thread the object is bound to\n */\n \n@@ -178,8 +183,7 @@ void Object::message(Message *msg)\n * \\param[in] thread The target thread\n *\n * This method moves the object and all its children from the current thread to\n- * the new \\a thread. It shall be called from the thread in which the object\n- * currently lives, otherwise the behaviour is undefined.\n+ * the new \\a thread.\n *\n * Before the object is moved, a Message::ThreadMoveMessage message is sent to\n * it. The message() method can be reimplement in derived classes to be notified\n@@ -187,6 +191,8 @@ void Object::message(Message *msg)\n *\n * Moving an object that has a parent is not allowed, and causes undefined\n * behaviour.\n+ *\n+ * \\context This function is thread-bound.\n */\n void Object::moveToThread(Thread *thread)\n {\ndiff --git a/src/libcamera/thread.cpp b/src/libcamera/thread.cpp\nindex 38e01771111d..1d0a600ab5cc 100644\n--- a/src/libcamera/thread.cpp\n+++ b/src/libcamera/thread.cpp\n@@ -222,6 +222,8 @@ ThreadData *ThreadData::current()\n * called. A custom event dispatcher may be installed with\n * setEventDispatcher(), otherwise a poll-based event dispatcher is used. This\n * behaviour can be overriden by overloading the run() method.\n+ *\n+ * \\context This class is \\threadsafe.\n */\n \n /**\ndiff --git a/src/libcamera/timer.cpp b/src/libcamera/timer.cpp\nindex 4c68883204e8..24da51524efb 100644\n--- a/src/libcamera/timer.cpp\n+++ b/src/libcamera/timer.cpp\n@@ -67,16 +67,18 @@ Timer::~Timer()\n * \\brief Start or restart the timer with a timeout of \\a msec\n * \\param[in] msec The timer duration in milliseconds\n *\n- * This method shall be called from the thread the timer is associated with. If\n- * the timer is already running it will be stopped and restarted.\n+ * If the timer is already running it will be stopped and restarted.\n+ *\n+ * \\context This function is \\threadbound.\n */\n \n /**\n * \\brief Start or restart the timer with a timeout of \\a duration\n * \\param[in] duration The timer duration in milliseconds\n *\n- * This method shall be called from the thread the timer is associated with. If\n- * the timer is already running it will be stopped and restarted.\n+ * If the timer is already running it will be stopped and restarted.\n+ *\n+ * \\context This function is \\threadbound.\n */\n void Timer::start(std::chrono::milliseconds duration)\n {\n@@ -87,8 +89,9 @@ void Timer::start(std::chrono::milliseconds duration)\n * \\brief Start or restart the timer with a \\a deadline\n * \\param[in] deadline The timer deadline\n *\n- * This method shall be called from the thread the timer is associated with. If\n- * the timer is already running it will be stopped and restarted.\n+ * If the timer is already running it will be stopped and restarted.\n+ *\n+ * \\context This function is \\threadbound.\n */\n void Timer::start(std::chrono::steady_clock::time_point deadline)\n {\n@@ -115,8 +118,9 @@ void Timer::start(std::chrono::steady_clock::time_point deadline)\n * After this function returns the timer is guaranteed not to emit the\n * \\ref timeout signal.\n *\n- * This method shall be called from the thread the timer is associated with. If\n- * the timer is not running this function performs no operation.\n+ * If the timer is not running this function performs no operation.\n+ *\n+ * \\context This function is \\threadbound.\n */\n void Timer::stop()\n {\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 82267730289d..b874f2384a53 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -403,6 +403,8 @@ const std::string V4L2DeviceFormat::toString() const\n *\n * Upon destruction any device left open will be closed, and any resources\n * released.\n+ *\n+ * \\context This class is \\threadbound.\n */\n \n /**\n", "prefixes": [ "libcamera-devel", "v2", "07/13" ] }