From be8efac78d067c138ad8dda03df4336e73f94887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 8 Jan 2022 11:51:07 +0100 Subject: New upstream version 1.0 --- tests/test-pthread_sigmask2.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'tests/test-pthread_sigmask2.c') diff --git a/tests/test-pthread_sigmask2.c b/tests/test-pthread_sigmask2.c index c8073568..585c1aa8 100644 --- a/tests/test-pthread_sigmask2.c +++ b/tests/test-pthread_sigmask2.c @@ -1,5 +1,5 @@ /* Test of pthread_sigmask in a multi-threaded program. - Copyright (C) 2011-2018 Free Software Foundation, Inc. + Copyright (C) 2011-2022 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,17 +21,16 @@ #include #include +#include #include #include -#include "glthread/thread.h" - #include "macros.h" -#if USE_POSIX_THREADS +#if USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS -static gl_thread_t main_thread; -static gl_thread_t killer_thread; +static pthread_t main_thread; +static pthread_t killer_thread; static void * killer_thread_func (void *arg) @@ -60,14 +59,17 @@ main (int argc, char *argv[]) sigaddset (&set, SIGINT); /* Check error handling. */ + /* This call returns 0 on NetBSD 8.0. */ +#if !defined __NetBSD__ ASSERT (pthread_sigmask (1729, &set, NULL) == EINVAL); +#endif /* Block SIGINT. */ ASSERT (pthread_sigmask (SIG_BLOCK, &set, NULL) == 0); /* Request a SIGINT signal from another thread. */ - main_thread = gl_thread_self (); - ASSERT (glthread_create (&killer_thread, killer_thread_func, NULL) == 0); + main_thread = pthread_self (); + ASSERT (pthread_create (&killer_thread, NULL, killer_thread_func, NULL) == 0); /* Wait. */ sleep (2); @@ -84,6 +86,10 @@ main (int argc, char *argv[]) before the call to pthread_sigmask() returns." */ ASSERT (sigint_occurred == 1); + /* Clean up the thread. This avoid a "ThreadSanitizer: thread leak" warning + from "gcc -fsanitize=thread". */ + ASSERT (pthread_join (killer_thread, NULL) == 0); + return 0; } -- cgit v1.2.3