]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
threads-h: Support several gnulib-tool invocations better.
authorBruno Haible <bruno@clisp.org>
Tue, 24 Dec 2024 10:22:40 +0000 (11:22 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 24 Dec 2024 13:30:03 +0000 (14:30 +0100)
* lib/threads.in.h (_GL_ALREADY_INCLUDING_THREADS_H): Rename to a macro
that depends on GUARD_PREFIX.
(struct thrd_with_exitcode): Avoid duplicate definition.

ChangeLog
lib/threads.in.h

index bec6cc301ef0787877028eb57e91d02733ac2129..b2175edb0b5704174a42981147d7c5ebeed79626 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-12-24  Bruno Haible  <bruno@clisp.org>
+
+       threads-h: Support several gnulib-tool invocations better.
+       * lib/threads.in.h (_GL_ALREADY_INCLUDING_THREADS_H): Rename to a macro
+       that depends on GUARD_PREFIX.
+       (struct thrd_with_exitcode): Avoid duplicate definition.
+
 2024-12-24  Bruno Haible  <bruno@clisp.org>
 
        sys_socket: Support several gnulib-tool invocations better.
index 91834d0788f588a443a048db8087899eb4c8284a..fd4a5818ad21a7f2e52da77714a704a63c61b8f6 100644 (file)
@@ -20,7 +20,7 @@
 #endif
 @PRAGMA_COLUMNS@
 
-#if defined _GL_ALREADY_INCLUDING_THREADS_H
+#if defined _@GUARD_PREFIX@_ALREADY_INCLUDING_THREADS_H
 /* Special invocation convention:
    - On Android we have a sequence of nested includes
      <threads.h> -> <android/legacy_threads_inlines.h>
 
 #ifndef _@GUARD_PREFIX@_THREADS_H
 
-#define _GL_ALREADY_INCLUDING_THREADS_H
+#define _@GUARD_PREFIX@_ALREADY_INCLUDING_THREADS_H
 
 /* The include_next requires a split double-inclusion guard.  */
 #if @HAVE_THREADS_H@
 # @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_THREADS_H@
 #endif
 
-#undef _GL_ALREADY_INCLUDING_THREADS_H
+#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_THREADS_H
 
 #ifndef _@GUARD_PREFIX@_THREADS_H
 #define _@GUARD_PREFIX@_THREADS_H
@@ -144,6 +144,7 @@ typedef pthread_t thrd_t;
 #endif
 #if @BROKEN_THRD_START_T@ || @BROKEN_THRD_JOIN@
 /* Need to override thrd_t, to make thrd_join work.  */
+# if !defined GNULIB_defined_struct_thrd_with_exitcode
 struct thrd_with_exitcode
 {
   thrd_t volatile tid;
@@ -151,7 +152,9 @@ struct thrd_with_exitcode
   int volatile exitcode;
 };
 typedef struct thrd_with_exitcode *rpl_thrd_t;
-# define thrd_t rpl_thrd_t
+#  define thrd_t rpl_thrd_t
+#  define GNULIB_defined_struct_thrd_with_exitcode 1
+# endif
 #endif
 /* Type of the main function of a thread.  */
 #if !@HAVE_THREADS_H@ || @BROKEN_THRD_START_T@