From patchwork Wed Aug 13 10:25:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 24097 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 E369EBDCC1 for ; Wed, 13 Aug 2025 10:25:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DB0E369250; Wed, 13 Aug 2025 12:25:07 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="t8D69gpq"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F13686922C for ; Wed, 13 Aug 2025 12:25:04 +0200 (CEST) Received: from pb-laptop.local (185.221.141.188.nat.pool.zt.hu [185.221.141.188]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7E0ED346 for ; Wed, 13 Aug 2025 12:24:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1755080651; bh=5HAUt5rRjVjrzuGazKTPnrgTw8ZKjuEOLatJGTUunxI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=t8D69gpqm4rugSOx7+86rF8wTNxoFI4ulHTViRgDZOZqc5Dx+/rysXW7PHq6gDHfA lkU086kmSM+3n66xR5R3X063+iz9os/gZBjNZs0E94BPbbfOufosd2IC+zyCbSggmG rbH8ou/cSogUhS0BRy1KCwIwufBG86J/pO/P4quc= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [RFC PATCH v2 1/2] libcamera: base: thread: Make `removeMessages()` public Date: Wed, 13 Aug 2025 12:25:00 +0200 Message-ID: <20250813102501.1645940-2-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250813102501.1645940-1-barnabas.pocze@ideasonboard.com> References: <20250813102501.1645940-1-barnabas.pocze@ideasonboard.com> MIME-Version: 1.0 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" Sometimes there is a need to remove pending messages of an object. For example, when the main purpose of a thread is to carry out work asynchronously using invoke messages, then there might be a need to stop processing because some kind of state has changed. This can be done in two main ways: flushing messages or removing them. This changes enables the second option, which is useful if the effects of the pending messages are no longer desired. Signed-off-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart --- include/libcamera/base/thread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/libcamera/base/thread.h b/include/libcamera/base/thread.h index b9284c2c0..eb1a52ab1 100644 --- a/include/libcamera/base/thread.h +++ b/include/libcamera/base/thread.h @@ -50,6 +50,7 @@ public: void dispatchMessages(Message::Type type = Message::Type::None, Object *receiver = nullptr); + void removeMessages(Object *receiver); protected: int exec(); @@ -64,7 +65,6 @@ private: void setThreadAffinityInternal(); void postMessage(std::unique_ptr msg, Object *receiver); - void removeMessages(Object *receiver); friend class Object; friend class ThreadData;