diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2022-01-08 11:51:39 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2022-01-08 11:51:39 +0100 |
commit | 2959e59fab3bab834368adefd90bd4b1b094366b (patch) | |
tree | 7d0ae09775ea950056193eaa2ca93844299d46f1 /tests/test-pthread_sigmask2.c | |
parent | c78359d9542c86b972aac373efcf7bc7a8a560e5 (diff) | |
parent | be8efac78d067c138ad8dda03df4336e73f94887 (diff) |
Update upstream source from tag 'upstream/1.0'
Update to upstream version '1.0'
with Debian dir 4875e7dc9f7277205f0086a63ee21ccdb1d54593
Diffstat (limited to 'tests/test-pthread_sigmask2.c')
-rw-r--r-- | tests/test-pthread_sigmask2.c | 22 |
1 files changed, 14 insertions, 8 deletions
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 <signal.h> #include <errno.h> +#include <pthread.h> #include <stdio.h> #include <unistd.h> -#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; } |