From nobody Tue Apr 16 06:23:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail header.i=@quicinc.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1610477398; cv=none; d=zohomail.com; s=zohoarc; b=bHcQXyANtLMJJJ3GlKpWBS1xYtoFZLDnkpJsR19QPhEu5JTMYSfE4ssazkqOxPSv4bJeODW5PCryd8AMg8hi5LvgcR0FBGPOFaAJqIiyXhVFFFFPKQJ59ZULVpVPn4XQeJPIM00l+INFhBDOBTkqJT+eOdKoEs9RLYV1tz0hjxM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610477398; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=BjA628x1E9gw2CI/Ie6r3h8ZsmM5RzRDJbzgR2vxyNg=; b=BYUuHTWNUwDsGdoJ3X4Lrzm+WL0Ws5jUS6IM/nTty+KXPahRv+JnrYld/X9+YTr2wfgrPkImHupgTWJQDRsjrrMsryLBij9+A4CR/KeCLTFo9zvKF+zLNFLd6TJSMXTTmclJ5WitclGQCsWbNEmOo35tKHObkb3Gv9xz7i8KZIE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail header.i=@quicinc.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610477398066635.0059360057894; Tue, 12 Jan 2021 10:49:58 -0800 (PST) Received: from localhost ([::1]:54082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzOjs-0006Rm-07 for importer@patchew.org; Tue, 12 Jan 2021 13:49:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzOTs-0007pQ-Qn for qemu-devel@nongnu.org; Tue, 12 Jan 2021 13:33:24 -0500 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:31885) by eggs.gnu.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kzOTq-0006PG-5m for qemu-devel@nongnu.org; Tue, 12 Jan 2021 13:33:24 -0500 Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-02.qualcomm.com with ESMTP; 12 Jan 2021 10:33:18 -0800 Received: from vu-tsimpson-aus.qualcomm.com (HELO vu-tsimpson1-aus.qualcomm.com) ([10.222.150.1]) by ironmsg03-sd.qualcomm.com with ESMTP; 12 Jan 2021 10:33:18 -0800 Received: by vu-tsimpson1-aus.qualcomm.com (Postfix, from userid 47164) id 33FE7AA3; Tue, 12 Jan 2021 12:33:18 -0600 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1610476402; x=1642012402; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=BjA628x1E9gw2CI/Ie6r3h8ZsmM5RzRDJbzgR2vxyNg=; b=ATf72xnEf9l9JEa0hcWZBrMVroUYaRybz7YQgddCXPN8c9HRiwwqDGqL YmBJ8huSY6kLrmKaqNXYeVHom7M+FUMKm6gIwBoNBrnz2p0U9JGn8gwmh WDcqKfbP3eNpzXcc/uqR4bRxX5A6+EUqDmwRkvRK8G1YsEiXxD1fqTwkV M=; X-QCInternal: smtphost From: Taylor Simpson To: qemu-devel@nongnu.org Subject: [PATCH] tests/tcg/multiarch/testthread.c: Add pthread_cancel test Date: Tue, 12 Jan 2021 12:33:04 -0600 Message-Id: <1610476384-13760-1-git-send-email-tsimpson@quicinc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=199.106.114.39; envelope-from=tsimpson@qualcomm.com; helo=alexa-out-sd-02.qualcomm.com X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tsimpson@quicinc.com, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) --- tests/tcg/multiarch/testthread.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/tcg/multiarch/testthread.c b/tests/tcg/multiarch/testthr= ead.c index 810ba5d..b30b4b5 100644 --- a/tests/tcg/multiarch/testthread.c +++ b/tests/tcg/multiarch/testthread.c @@ -50,8 +50,29 @@ void test_pthread(void) printf("End of pthread test.\n"); } =20 +void *thread3_func(void *arg) +{ + usleep(3 * 1000); + return 0; +} + +void test_cancel(void) +{ + pthread_t thread; + void *res; + + pthread_create(&thread, 0, thread3_func, NULL); + pthread_cancel(thread); + pthread_join(thread, &res); + if (res !=3D PTHREAD_CANCELED) { + puts("ERROR: thread not cancelled"); + exit(EXIT_FAILURE); + } +} + int main(int argc, char **argv) { test_pthread(); + test_cancel(); return 0; } --=20 2.7.4