From 00893e79fc62966067af1a106567db96bd170338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 3 Mar 2024 19:11:32 +0100 Subject: New upstream version 1.2 --- tests/glthread/thread.c | 10 ++++++---- tests/glthread/thread.h | 12 ++++++++++-- tests/glthread/yield.h | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) (limited to 'tests/glthread') diff --git a/tests/glthread/thread.c b/tests/glthread/thread.c index 0b923c04..9c8c3035 100644 --- a/tests/glthread/thread.c +++ b/tests/glthread/thread.c @@ -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 @@ -139,9 +139,11 @@ gl_thread_self (void) /* Memory allocation failed. There is not much we can do. Have to busy-loop, waiting for the availability of memory. */ { - struct timespec ts; - ts.tv_sec = 1; - ts.tv_nsec = 0; + struct timespec ts = + { + .tv_sec = 1, + .tv_nsec = 0 + }; thrd_sleep (&ts, NULL); } } 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 #include @@ -125,6 +130,9 @@ extern _Noreturn void gl_thread_exit (void *return_value); # include +/* Get intptr_t. */ +# include + /* On IRIX, pthread_atfork is declared in , not in . */ # if defined __sgi # include @@ -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) diff --git a/tests/glthread/yield.h b/tests/glthread/yield.h index f74267ea..29105cc2 100644 --- a/tests/glthread/yield.h +++ b/tests/glthread/yield.h @@ -1,5 +1,5 @@ /* Yielding the processor to other threads and processes. - 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 -- cgit v1.2.3