{"id":22945,"url":"https://patchwork.libcamera.org/api/1.1/patches/22945/?format=json","web_url":"https://patchwork.libcamera.org/patch/22945/","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":"<20250310170318.185249-1-barnabas.pocze@ideasonboard.com>","date":"2025-03-10T17:03:18","name":"[v1] test: thread: Use `pthread_testcancel()`","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"dec44d40a173ecdd35de2e958e408b737df3b71b","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/1.1/people/216/?format=json","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/22945/mbox/","series":[{"id":5053,"url":"https://patchwork.libcamera.org/api/1.1/series/5053/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5053","date":"2025-03-10T17:03:18","name":"[v1] test: thread: Use `pthread_testcancel()`","version":1,"mbox":"https://patchwork.libcamera.org/series/5053/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/22945/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/22945/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 596C4C32F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 10 Mar 2025 17:03:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0B4116891F;\n\tMon, 10 Mar 2025 18:03:26 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DF3D468890\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 10 Mar 2025 18:03:23 +0100 (CET)","from pb-laptop.local (185.221.143.221.nat.pool.zt.hu\n\t[185.221.143.221])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3215C227\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 10 Mar 2025 18:01:47 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"S4ubJhkI\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1741626107;\n\tbh=LVBTW1IN6Gzw3DlnDC1hIAIMsLSIsCGuUEx2hzslnmM=;\n\th=From:To:Subject:Date:From;\n\tb=S4ubJhkI2tfsm/kqhMUjcbX6/TvZdvQlO5k4m+osaRszTcQQW1M/8d//LPCPSj/iN\n\tfZ7YDAagyKzwUm6wy/IOhiSJINSF8wZU7FxvMKDZVxKsPD0kjoOvLYa542ixY45FdW\n\tlkEHdSkTFk8bLKrm8q6clfUxCmHDmezmuUM4celA=","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH v1] test: thread: Use `pthread_testcancel()`","Date":"Mon, 10 Mar 2025 18:03:18 +0100","Message-ID":"<20250310170318.185249-1-barnabas.pocze@ideasonboard.com>","X-Mailer":"git-send-email 2.48.1","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","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":"`pthread_testcancel()` is a guaranteed cancellation point,\nspecifically for testing if cancellation has been requested,\nso use it.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n test/threads.cpp | 8 +-------\n 1 file changed, 1 insertion(+), 7 deletions(-)","diff":"diff --git a/test/threads.cpp b/test/threads.cpp\nindex 8d6ee1510..c00d95a41 100644\n--- a/test/threads.cpp\n+++ b/test/threads.cpp\n@@ -52,14 +52,8 @@ protected:\n \t{\n \t\tcancelled_ = true;\n \n-\t\t/*\n-\t\t * Cancel the thread and call a guaranteed cancellation point\n-\t\t * (nanosleep).\n-\t\t */\n \t\tpthread_cancel(pthread_self());\n-\n-\t\tstruct timespec req{ 0, 100*000*000 };\n-\t\tnanosleep(&req, nullptr);\n+\t\tpthread_testcancel();\n \n \t\tcancelled_ = false;\n \t}\n","prefixes":["v1"]}