{"id":2807,"url":"https://patchwork.libcamera.org/api/patches/2807/?format=json","web_url":"https://patchwork.libcamera.org/patch/2807/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20200213124538.21556-3-laurent.pinchart@ideasonboard.com>","date":"2020-02-13T12:45:38","name":"[libcamera-devel,v2,3/3] test: thread: Test waiting on a thread that is not running","commit_ref":"a9b83617d27891853888a0eebb6702d02677090d","pull_url":null,"state":"accepted","archived":false,"hash":"723ba5733e6fb5518962eaa281686fd556ad6394","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2807/mbox/","series":[{"id":669,"url":"https://patchwork.libcamera.org/api/series/669/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=669","date":"2020-02-13T12:45:36","name":"[libcamera-devel,v2,1/3] libcamera: thread: Support timeout in wait() function","version":2,"mbox":"https://patchwork.libcamera.org/series/669/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2807/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2807/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 EF27F6043A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 13 Feb 2020 13:45:59 +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 8450C504\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 13 Feb 2020 13:45:59 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1581597959;\n\tbh=yTjfeCUuzzHClP8uKiPMr2KvanveOhM2krUNf7dyVFI=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=EGSev8OEUJ7Ntcp+BURwjRwWcJZOz9ecpQbZ12vl1/Z+6Qb/ZMHV7ZdZwJxSmpDXb\n\tddwxfPVNcdiIaBgfYdf821T6wAJpS2yt9YwKXm9SiiLlTNB4dh2eN/Fl/F85c5jfwv\n\tmWjfMf3lZkiQ9DjrgTizEagKlzW8VBkUDBt0hCp4=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 13 Feb 2020 14:45:38 +0200","Message-Id":"<20200213124538.21556-3-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.24.1","In-Reply-To":"<20200213124538.21556-1-laurent.pinchart@ideasonboard.com>","References":"<20200213124538.21556-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 3/3] test: thread: Test waiting on a\n\tthread that is not running","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":"Thu, 13 Feb 2020 12:46:00 -0000"},"content":"Test that Thread::wait() on a thread that hasn't been started, or on a\nthread that is known to have completed, returns without a timeout.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/threads.cpp | 19 +++++++++++++++++++\n 1 file changed, 19 insertions(+)","diff":"diff --git a/test/threads.cpp b/test/threads.cpp\nindex 1fa26020ce5c..0454761de12c 100644\n--- a/test/threads.cpp\n+++ b/test/threads.cpp\n@@ -101,6 +101,25 @@ protected:\n \n \t\tdelete thread;\n \n+\t\t/* Test waiting on a thread that isn't running. */\n+\t\tthread = new Thread();\n+\n+\t\ttimeout = !thread->wait();\n+\t\tif (timeout) {\n+\t\t\tcout << \"Waiting for non-started thread timed out\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tthread->start();\n+\t\tthread->exit(0);\n+\t\tthread->wait();\n+\n+\t\ttimeout = !thread->wait();\n+\t\tif (timeout) {\n+\t\t\tcout << \"Waiting for already stopped thread timed out\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n \t\treturn TestPass;\n \t}\n \n","prefixes":["libcamera-devel","v2","3/3"]}