summaryrefslogtreecommitdiff
path: root/tests/test-pthread_sigmask2.c
diff options
context:
space:
mode:
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 c807356..585c1aa 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;
}