summaryrefslogtreecommitdiff
path: root/tests/test-pthread_sigmask2.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2022-01-08 11:51:07 +0100
committerJörg Frings-Fürst <debian@jff.email>2022-01-08 11:51:07 +0100
commitbe8efac78d067c138ad8dda03df4336e73f94887 (patch)
tree5f5254a628ba0ef72065b93d949d1c985742ea8e /tests/test-pthread_sigmask2.c
parent7b65dbd4ebade81d504cfe5e681292a58ad1fdf0 (diff)
New upstream version 1.0upstream/1.0
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;
}