summaryrefslogtreecommitdiff
path: root/tests/test-pthread_sigmask2.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2022-02-07 06:57:44 +0100
committerJörg Frings-Fürst <debian@jff.email>2022-02-07 06:57:44 +0100
commit6ffaa52cf732a84c0f8259dbc9b8183960ec5c33 (patch)
treed3136c22e3e805cfc0efe78412cce905a17e0c8d /tests/test-pthread_sigmask2.c
parent591cbf5878b7d4105b275585b9db1324c9dfce56 (diff)
parentaf151c593704a40e10efb28d1e3dd59a23a661f3 (diff)
Merge branch 'release/debian/1.0-1'debian/1.0-1
Diffstat (limited to 'tests/test-pthread_sigmask2.c')
-rw-r--r--tests/test-pthread_sigmask2.c22
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;
}