From patchwork Sun Jan 21 03:59:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 19427 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 4E8EBC32BD for ; Sun, 21 Jan 2024 03:59:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D206562951; Sun, 21 Jan 2024 04:59:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1705809597; bh=ypHTeS71nz6sHKStFmfA7pQqOYKn6VXfE0idipTqYPA=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=PgGu32Ef7vs8DQH93G4hpCHUUPYa3voFG5EaNBeQ4bclNCQHwD0MSbWs5ciLlaI9k p+3IDQ5WV9RosG58ha/dUwOl66If2sbOny40eETke3H3cZyqApGiIQtkWk6hcAwz6X 2TfMBQfrgs4FaXVvmCAlKN2sfi8R3SVVaPWGAO1Q7q29wpBaENC3nmcRsfSbJ7vqd9 JTetL4LiVVQyR3z0awcN5CAIg5R50tIxKQwpKNuijiErqnhLXkHDFMJU6a+KyPkzXH pdWfzZMX963S+PttSIbx8Dvr6W1y45CCszvYD+5X6zr8TGa0yvnTP6Gz1hysTPLqT/ awFdPMkgkexJA== 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 DB46F6294C for ; Sun, 21 Jan 2024 04:59:53 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="NYRdiHf2"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (89-27-53-110.bb.dnainternet.fi [89.27.53.110]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CCD44138B; Sun, 21 Jan 2024 04:58:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1705809522; bh=ypHTeS71nz6sHKStFmfA7pQqOYKn6VXfE0idipTqYPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NYRdiHf23eRIhYhHgD1Mf2ZAyZ5dOv+pP8cqpoDTMFdypesU3zb/tAMIDC9QDsqje ACawEhofWqxA8I0MdR7v8KdHEIMSm3YQgmvNAw+ldL60yUBkO+qoIteRUanvOQkYQE kljpeq1DhM7U1YkgdFxRffkelcW9GE7BxzqIMNTE= To: libcamera-devel@lists.libcamera.org Date: Sun, 21 Jan 2024 05:59:42 +0200 Message-ID: <20240121035948.4226-7-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240121035948.4226-1-laurent.pinchart@ideasonboard.com> References: <20240121035948.4226-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 06/12] test: message: Remove incorrect slow receiver test 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: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The slow receiver test verifies there's no race condition between concurrent message delivery and object deletion. This is no a valid use case in the first place, as objects are not allowed to be deleted from a different thread than the one they are bound to. Remove the incorrect test. Signed-off-by: Laurent Pinchart Reviewed-by: Milan Zamazal --- test/message.cpp | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/test/message.cpp b/test/message.cpp index 0e76f323e3b9..a34e0f0b5e10 100644 --- a/test/message.cpp +++ b/test/message.cpp @@ -93,25 +93,6 @@ private: bool success_; }; -class SlowMessageReceiver : public Object -{ -protected: - void message(Message *msg) - { - if (msg->type() != Message::None) { - Object::message(msg); - return; - } - - /* - * Don't access any member of the object here (including the - * vtable) as the object will be deleted by the main thread - * while we're sleeping. - */ - this_thread::sleep_for(chrono::milliseconds(100)); - } -}; - class MessageTest : public Test { protected: @@ -148,21 +129,6 @@ protected: break; } - /* - * Test for races between message delivery and object deletion. - * Failures result in assertion errors, there is no need for - * explicit checks. - */ - SlowMessageReceiver *slowReceiver = new SlowMessageReceiver(); - slowReceiver->moveToThread(&thread_); - slowReceiver->postMessage(std::make_unique(Message::None)); - - this_thread::sleep_for(chrono::milliseconds(10)); - - delete slowReceiver; - - this_thread::sleep_for(chrono::milliseconds(100)); - /* * Test recursive calls to Thread::dispatchMessages(). Messages * should be delivered correctly, without crashes or memory