From patchwork Fri Sep 26 11:07:07 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: 24470 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 61502C328C for ; Fri, 26 Sep 2025 11:07:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 48A5F6B5F8; Fri, 26 Sep 2025 13:07:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Nof9Ai2I"; dkim-atps=neutral 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 45B7B6B5AA for ; Fri, 26 Sep 2025 13:07:13 +0200 (CEST) Received: from pb-laptop.local (185.221.140.70.nat.pool.zt.hu [185.221.140.70]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C5E8E1807; Fri, 26 Sep 2025 13:05:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1758884747; bh=BRgpObAqrkaLmk3MaO4r97Uxh/5ymfSWs1KPGwiWopg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nof9Ai2I1rP3y/1RbIUopx/SHLLtNWnlXfTxXwZZSXAsCyzBKh/a22BpXOibXH9ZK kRrVa10+gVAcNZDPR68qmxqXp+fw0ekHeA9TLWhyrUyFPEYGn+VGDHe2wSps5INjfd D4Ht727n37aoitKzk3zNrDuyGW04K/Z4lp/vRgwU= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Cc: Laurent Pinchart Subject: [PATCH v3 1/2] libcamera: base: thread: Make `removeMessages()` public Date: Fri, 26 Sep 2025 13:07:07 +0200 Message-ID: <20250926110708.94112-2-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250926110708.94112-1-barnabas.pocze@ideasonboard.com> References: <20250926110708.94112-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;