summaryrefslogtreecommitdiff
path: root/tests/glthread/thread.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2024-03-03 19:11:32 +0100
committerJörg Frings-Fürst <debian@jff.email>2024-03-03 19:11:32 +0100
commit00893e79fc62966067af1a106567db96bd170338 (patch)
tree52b35cd0b42ca28e62a2ffbecade2e13dd8332cf /tests/glthread/thread.h
parent26112352a774737e1ce5580c93654a26c1e82b39 (diff)
New upstream version 1.2upstream/1.2upstream
Diffstat (limited to 'tests/glthread/thread.h')
-rw-r--r--tests/glthread/thread.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/glthread/thread.h b/tests/glthread/thread.h
index 6d98f2d6..748bb045 100644
--- a/tests/glthread/thread.h
+++ b/tests/glthread/thread.h
@@ -1,5 +1,5 @@
/* Creating and controlling threads.
- Copyright (C) 2005-2022 Free Software Foundation, Inc.
+ Copyright (C) 2005-2024 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@@ -70,6 +70,11 @@
#ifndef _GLTHREAD_THREAD_H
#define _GLTHREAD_THREAD_H
+/* This file uses _Noreturn, HAVE_THREADS_H, HAVE_PTHREAD_ATFORK. */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
#include <errno.h>
#include <stdlib.h>
@@ -125,6 +130,9 @@ extern _Noreturn void gl_thread_exit (void *return_value);
# include <pthread.h>
+/* Get intptr_t. */
+# include <stdint.h>
+
/* On IRIX, pthread_atfork is declared in <unistd.h>, not in <pthread.h>. */
# if defined __sgi
# include <unistd.h>
@@ -228,7 +236,7 @@ extern const gl_thread_t gl_null_thread;
# define gl_thread_self() \
(pthread_in_use () ? pthread_self () : (pthread_t) 0)
# define gl_thread_self_pointer() \
- (pthread_in_use () ? (void *) pthread_self () : NULL)
+ (pthread_in_use () ? (void *) (intptr_t) (pthread_t) pthread_self () : NULL)
# endif
# define gl_thread_exit(RETVAL) \
(void) (pthread_in_use () ? (pthread_exit (RETVAL), 0) : 0)