summaryrefslogtreecommitdiff
path: root/tests/glthread/thread.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-12-03 20:50:11 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-12-03 20:50:11 +0100
commit4cf52fc0bc3b80c0ef6c58c5db4413ebdafe661c (patch)
tree676b26b024117cf656080a011e3d17b8fb6889af /tests/glthread/thread.h
parent1ecbfbb92248e67b564f5b144c4671ccaa86ee2f (diff)
parent44ff3127b1e57b703c2a73a24f7ab38e4aad8ae4 (diff)
Merge branch 'release/0.9.8-1'0.9.8-1
Diffstat (limited to 'tests/glthread/thread.h')
-rw-r--r--tests/glthread/thread.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/tests/glthread/thread.h b/tests/glthread/thread.h
index 4488a9e..b64e267 100644
--- a/tests/glthread/thread.h
+++ b/tests/glthread/thread.h
@@ -1,5 +1,5 @@
/* Creating and controlling threads.
- Copyright (C) 2005-2016 Free Software Foundation, Inc.
+ Copyright (C) 2005-2017 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
@@ -12,7 +12,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
+ along with this program; if not, see <https://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>, 2005.
Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h,
@@ -64,7 +64,7 @@
void (*child_func) (void));
Note that even on platforms where this is supported, use of fork() and
threads together is problematic, see
- <http://lists.gnu.org/archive/html/bug-gnulib/2008-08/msg00062.html>
+ <https://lists.gnu.org/r/bug-gnulib/2008-08/msg00062.html>
*/
@@ -128,7 +128,9 @@ extern int glthread_in_use (void);
/* Without this, clang complains that pthread_sigmask is never declared. */
# include <signal.h>
# endif
-# pragma weak pthread_sigmask
+# ifndef pthread_sigmask /* Do not declare rpl_pthread_sigmask weak. */
+# pragma weak pthread_sigmask
+# endif
# pragma weak pthread_join
# ifndef pthread_self
@@ -219,6 +221,7 @@ extern "C" {
/* Use weak references to the GNU Pth threads library. */
+# pragma weak pth_init
# pragma weak pth_spawn
# pragma weak pth_sigmask
# pragma weak pth_join
@@ -237,17 +240,17 @@ extern "C" {
typedef pth_t gl_thread_t;
# define glthread_create(THREADP, FUNC, ARG) \
- (pth_in_use () ? ((*(THREADP) = pth_spawn (NULL, FUNC, ARG)) ? 0 : errno) : 0)
+ (pth_in_use () ? (pth_init (), ((*(THREADP) = pth_spawn (NULL, FUNC, ARG)) ? 0 : errno)) : 0)
# define glthread_sigmask(HOW, SET, OSET) \
- (pth_in_use () && !pth_sigmask (HOW, SET, OSET) ? errno : 0)
+ (pth_in_use () ? (pth_init (), (pth_sigmask (HOW, SET, OSET) ? 0 : errno)) : 0)
# define glthread_join(THREAD, RETVALP) \
- (pth_in_use () && !pth_join (THREAD, RETVALP) ? errno : 0)
+ (pth_in_use () ? (pth_init (), (pth_join (THREAD, RETVALP) ? 0 : errno)) : 0)
# define gl_thread_self() \
- (pth_in_use () ? (void *) pth_self () : NULL)
+ (pth_in_use () ? (pth_init (), (void *) pth_self ()) : NULL)
# define gl_thread_self_pointer() \
gl_thread_self ()
# define gl_thread_exit(RETVAL) \
- (pth_in_use () ? pth_exit (RETVAL) : 0)
+ (pth_in_use () ? (pth_init (), pth_exit (RETVAL)) : 0)
# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0
# ifdef __cplusplus