summaryrefslogtreecommitdiff
path: root/lib/threads.in.h
blob: 5fcbb09039c7d1c624fb7cbd0fa32f90a712909c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
/* An ISO C 11 compatible <threads.h>.

   Copyright (C) 2019 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
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   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 <https://www.gnu.org/licenses/>.  */

#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@

#ifndef _@GUARD_PREFIX@_THREADS_H

/* The include_next requires a split double-inclusion guard.  */
#if @HAVE_THREADS_H@
# @INCLUDE_NEXT@ @NEXT_THREADS_H@
#endif

#ifndef _@GUARD_PREFIX@_THREADS_H
#define _@GUARD_PREFIX@_THREADS_H

#if !@HAVE_THREADS_H@

# include <time.h>

# if defined _WIN32 && ! defined __CYGWIN__
/* Use Windows threads.  */

#  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
#  include <windows.h>

# else
/* Use POSIX threads.  */

#  include <pthread.h>

# endif

#endif

/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */

/* The definition of _Noreturn is copied here.  */

/* The definition of _GL_ARG_NONNULL is copied here.  */

/* The definition of _GL_WARN_ON_USE is copied here.  */


/* Storage class specifier for thread-local storage.  */
#ifdef _AIX
/* The macro definition from AIX 7.1..7.2 <threads.h> is unusable, because
   its expansion ends in a semicolon.  */
# undef thread_local
#endif
#if !@HAVE_THREADS_H@ || !defined thread_local
# define thread_local _Thread_local
#endif
/* Define the macro thread_local if and only if it actually works.  */
#if !@HAVE_THREAD_LOCAL@
# undef thread_local
#endif


/* =========== ISO C 11 7.26.5 Thread functions =========== */

#if !@HAVE_THREADS_H@

/* Return codes.  */
enum
{
  thrd_success  = 0,
  thrd_timedout = 1,
  thrd_busy     = 2,
  thrd_nomem    = 3,
  thrd_error    = 4
};

# if defined _WIN32 && ! defined __CYGWIN__
/* Use Windows threads.  */

#  include "windows-thread.h"

typedef glwthread_thread_t thrd_t;

# else
/* Use POSIX threads.  */

typedef pthread_t thrd_t;

# endif

#endif

#if @BROKEN_THRD_START_T@
/* Need to override thrd_start_t, to make thrd_create work.  */
# define thrd_start_t rpl_thrd_start_t
/* Need to override thrd_t, to make thrd_join work.  */
struct thrd_with_exitcode
{
  thrd_t volatile tid;
  int volatile detached;
  int volatile exitcode;
};
typedef struct thrd_with_exitcode *rpl_thrd_t;
# define thrd_t rpl_thrd_t
#endif
/* Type of the main function of a thread.  */
#if !@HAVE_THREADS_H@ || @BROKEN_THRD_START_T@
typedef int (* thrd_start_t) (void *);
#endif

#if @GNULIB_THRD@
# if @REPLACE_THRD_CREATE@
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
#   define thrd_create rpl_thrd_create
#  endif
_GL_FUNCDECL_RPL (thrd_create, int, (thrd_t *, thrd_start_t, void *)
                                    _GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (thrd_create, int, (thrd_t *, thrd_start_t, void *));
# else
#  if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (thrd_create, int, (thrd_t *, thrd_start_t, void *)
                                    _GL_ARG_NONNULL ((1, 2)));
#  endif
_GL_CXXALIAS_SYS (thrd_create, int, (thrd_t *, thrd_start_t, void *));
# endif
_GL_CXXALIASWARN (thrd_create);
#elif defined GNULIB_POSIXCHECK
# undef thrd_create
# if HAVE_RAW_DECL_THRD_CREATE
_GL_WARN_ON_USE (thrd_create, "thrd_create is unportable - "
                 "use gnulib module thrd for portability");
# endif
#endif

#if @GNULIB_THRD@
# if @REPLACE_THRD_CURRENT@
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
#   define thrd_current rpl_thrd_current
#  endif
_GL_FUNCDECL_RPL (thrd_current, thrd_t, (void) _GL_ATTRIBUTE_PURE);
_GL_CXXALIAS_RPL (thrd_current, thrd_t, (void));
# else
#  if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (thrd_current, thrd_t, (void) _GL_ATTRIBUTE_PURE);
#  endif
_GL_CXXALIAS_SYS (thrd_current, thrd_t, (void));
# endif
_GL_CXXALIASWARN (thrd_current);
#elif defined GNULIB_POSIXCHECK
# undef thrd_current
# if HAVE_RAW_DECL_THRD_CURRENT
_GL_WARN_ON_USE (thrd_current, "thrd_current is unportable - "
                 "use gnulib module thrd for portability");
# endif
#endif

#if @GNULIB_THRD@
# if @REPLACE_THRD_EQUAL@
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
#   define thrd_equal rpl_thrd_equal
#  endif
_GL_FUNCDECL_RPL (thrd_equal, int, (thrd_t, thrd_t) _GL_ATTRIBUTE_PURE);
_GL_CXXALIAS_RPL (thrd_equal, int, (thrd_t, thrd_t));
# else
#  if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (thrd_equal, int, (thrd_t, thrd_t) _GL_ATTRIBUTE_PURE);
#  endif
_GL_CXXALIAS_SYS (thrd_equal, int, (thrd_t, thrd_t));
# endif
_GL_CXXALIASWARN (thrd_equal);
#elif defined GNULIB_POSIXCHECK
# undef thrd_equal
# if HAVE_RAW_DECL_THRD_EQUAL
_GL_WARN_ON_USE (thrd_equal, "thrd_equal is unportable - "
                 "use gnulib module thrd for portability");
# endif
#endif

#if @GNULIB_THRD@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (thrd_sleep, int,
                              (const struct timespec *, struct timespec *)
                              _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (thrd_sleep, int,
                              (const struct timespec *, struct timespec *));
_GL_CXXALIASWARN (thrd_sleep);
#elif defined GNULIB_POSIXCHECK
# undef thrd_sleep
# if HAVE_RAW_DECL_THRD_SLEEP
_GL_WARN_ON_USE (thrd_sleep, "thrd_sleep is unportable - "
                 "use gnulib module thrd for portability");
# endif
#endif

#if @GNULIB_THRD@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (thrd_yield, void, (void));
# endif
_GL_CXXALIAS_SYS (thrd_yield, void, (void));
_GL_CXXALIASWARN (thrd_yield);
#elif defined GNULIB_POSIXCHECK
# undef thrd_yield
# if HAVE_RAW_DECL_THRD_YIELD
_GL_WARN_ON_USE (thrd_yield, "thrd_yield is unportable - "
                 "use gnulib module thrd for portability");
# endif
#endif

#if @GNULIB_THRD@
# if @REPLACE_THRD_DETACH@
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
#   define thrd_detach rpl_thrd_detach
#  endif
_GL_FUNCDECL_RPL (thrd_detach, int, (thrd_t));
_GL_CXXALIAS_RPL (thrd_detach, int, (thrd_t));
# else
#  if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (thrd_detach, int, (thrd_t));
#  endif
_GL_CXXALIAS_SYS (thrd_detach, int, (thrd_t));
# endif
_GL_CXXALIASWARN (thrd_detach);
#elif defined GNULIB_POSIXCHECK
# undef thrd_detach
# if HAVE_RAW_DECL_THRD_DETACH
_GL_WARN_ON_USE (thrd_detach, "thrd_detach is unportable - "
                 "use gnulib module thrd for portability");
# endif
#endif

#if @GNULIB_THRD@
# if @REPLACE_THRD_JOIN@
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
#   define thrd_join rpl_thrd_join
#  endif
_GL_FUNCDECL_RPL (thrd_join, int, (thrd_t, int *));
_GL_CXXALIAS_RPL (thrd_join, int, (thrd_t, int *));
# else
#  if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (thrd_join, int, (thrd_t, int *));
#  endif
_GL_CXXALIAS_SYS (thrd_join, int, (thrd_t, int *));
# endif
_GL_CXXALIASWARN (thrd_join);
#elif defined GNULIB_POSIXCHECK
# undef thrd_join
# if HAVE_RAW_DECL_THRD_JOIN
_GL_WARN_ON_USE (thrd_join, "thrd_join is unportable - "
                 "use gnulib module thrd for portability");
# endif
#endif

#if @GNULIB_THRD@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (thrd_exit, _Noreturn void, (int));
# endif
/* Need to cast because of AIX with xlclang++.  */
_GL_CXXALIAS_SYS_CAST (thrd_exit, void, (int));
_GL_CXXALIASWARN (thrd_exit);
#elif defined GNULIB_POSIXCHECK
# undef thrd_exit
# if HAVE_RAW_DECL_THRD_EXIT
_GL_WARN_ON_USE (thrd_exit, "thrd_exit is unportable - "
                 "use gnulib module thrd for portability");
# endif
#endif


/* =========== ISO C 11 7.26.4 Mutex functions =========== */

#if !@HAVE_THREADS_H@

/* Types of mutexes.  */
enum
{
  mtx_plain     = 0,
  mtx_timed     = 1,
  mtx_recursive = 2
};

# if defined _WIN32 && ! defined __CYGWIN__
/* Use Windows threads.  */

#  include "windows-mutex.h"
#  include "windows-recmutex.h"
#  include "windows-timedmutex.h"
#  include "windows-timedrecmutex.h"

typedef struct
        {
          int type;
          union
            {
              glwthread_mutex_t         u_mutex;
              glwthread_recmutex_t      u_recmutex;
              glwthread_timedmutex_t    u_timedmutex;
              glwthread_timedrecmutex_t u_timedrecmutex;
            }
          u;
        }
        mtx_t;

# else
/* Use POSIX threads.  */

typedef pthread_mutex_t mtx_t;

# endif

#endif

#if @GNULIB_MTX@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (mtx_init, int, (mtx_t *, int) _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (mtx_init, int, (mtx_t *, int));
_GL_CXXALIASWARN (mtx_init);
#elif defined GNULIB_POSIXCHECK
# undef mtx_init
# if HAVE_RAW_DECL_MTX_INIT
_GL_WARN_ON_USE (mtx_init, "mtx_init is unportable - "
                 "use gnulib module mtx for portability");
# endif
#endif

#if @GNULIB_MTX@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (mtx_lock, int, (mtx_t *) _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (mtx_lock, int, (mtx_t *));
_GL_CXXALIASWARN (mtx_lock);
#elif defined GNULIB_POSIXCHECK
# undef mtx_lock
# if HAVE_RAW_DECL_MTX_LOCK
_GL_WARN_ON_USE (mtx_lock, "mtx_lock is unportable - "
                 "use gnulib module mtx for portability");
# endif
#endif

#if @GNULIB_MTX@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (mtx_trylock, int, (mtx_t *) _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (mtx_trylock, int, (mtx_t *));
_GL_CXXALIASWARN (mtx_trylock);
#elif defined GNULIB_POSIXCHECK
# undef mtx_trylock
# if HAVE_RAW_DECL_MTX_TRYLOCK
_GL_WARN_ON_USE (mtx_trylock, "mtx_trylock is unportable - "
                 "use gnulib module mtx for portability");
# endif
#endif

#if @GNULIB_MTX@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (mtx_timedlock, int, (mtx_t *, const struct timespec *)
                                      _GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (mtx_timedlock, int, (mtx_t *, const struct timespec *));
_GL_CXXALIASWARN (mtx_timedlock);
#elif defined GNULIB_POSIXCHECK
# undef mtx_timedlock
# if HAVE_RAW_DECL_MTX_TIMEDLOCK
_GL_WARN_ON_USE (mtx_timedlock, "mtx_timedlock is unportable - "
                 "use gnulib module mtx for portability");
# endif
#endif

#if @GNULIB_MTX@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (mtx_unlock, int, (mtx_t *) _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (mtx_unlock, int, (mtx_t *));
_GL_CXXALIASWARN (mtx_unlock);
#elif defined GNULIB_POSIXCHECK
# undef mtx_unlock
# if HAVE_RAW_DECL_MTX_UNLOCK
_GL_WARN_ON_USE (mtx_unlock, "mtx_unlock is unportable - "
                 "use gnulib module mtx for portability");
# endif
#endif

#if @GNULIB_MTX@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (mtx_destroy, void, (mtx_t *) _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (mtx_destroy, void, (mtx_t *));
_GL_CXXALIASWARN (mtx_destroy);
#elif defined GNULIB_POSIXCHECK
# undef mtx_destroy
# if HAVE_RAW_DECL_MTX_DESTROY
_GL_WARN_ON_USE (mtx_destroy, "mtx_destroy is unportable - "
                 "use gnulib module mtx for portability");
# endif
#endif


/* =========== ISO C 11 7.26.2 Initialization functions =========== */

#if !@HAVE_THREADS_H@

/* Type that contains a flag for use by call_once.  */
# if defined _WIN32 && ! defined __CYGWIN__
/* Use Windows threads.  */

#  include "windows-once.h"

typedef glwthread_once_t once_flag;
#  define ONCE_FLAG_INIT GLWTHREAD_ONCE_INIT

# else
/* Use POSIX threads.  */

typedef pthread_once_t once_flag;
#  define ONCE_FLAG_INIT PTHREAD_ONCE_INIT

# endif

#endif

#if @GNULIB_MTX@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (call_once, void, (once_flag *, void (*) (void))
                                   _GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS_CAST (call_once, void, (once_flag *, void (*) (void)));
_GL_CXXALIASWARN (call_once);
#elif defined GNULIB_POSIXCHECK
# undef call_once
# if HAVE_RAW_DECL_CALL_ONCE
_GL_WARN_ON_USE (call_once, "call_once is unportable - "
                 "use gnulib module mtx for portability");
# endif
#endif


/* =========== ISO C 11 7.26.3 Condition variable functions =========== */

#if !@HAVE_THREADS_H@

# if defined _WIN32 && ! defined __CYGWIN__
/* Use Windows threads.  */

#  include "windows-cond.h"

typedef glwthread_cond_t cnd_t;

# else
/* Use POSIX threads.  */

typedef pthread_cond_t cnd_t;

# endif

#endif

#if @GNULIB_CND@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (cnd_init, int, (cnd_t *) _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (cnd_init, int, (cnd_t *));
_GL_CXXALIASWARN (cnd_init);
#elif defined GNULIB_POSIXCHECK
# undef cnd_init
# if HAVE_RAW_DECL_CND_INIT
_GL_WARN_ON_USE (cnd_init, "cnd_init is unportable - "
                 "use gnulib module cnd for portability");
# endif
#endif

#if @GNULIB_CND@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (cnd_wait, int, (cnd_t *, mtx_t *) _GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (cnd_wait, int, (cnd_t *, mtx_t *));
_GL_CXXALIASWARN (cnd_wait);
#elif defined GNULIB_POSIXCHECK
# undef cnd_wait
# if HAVE_RAW_DECL_CND_WAIT
_GL_WARN_ON_USE (cnd_wait, "cnd_wait is unportable - "
                 "use gnulib module cnd for portability");
# endif
#endif

#if @GNULIB_CND@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (cnd_timedwait, int,
                                 (cnd_t *, mtx_t *, const struct timespec *)
                                 _GL_ARG_NONNULL ((1, 2, 3)));
# endif
_GL_CXXALIAS_SYS (cnd_timedwait, int,
                                 (cnd_t *, mtx_t *, const struct timespec *));
_GL_CXXALIASWARN (cnd_timedwait);
#elif defined GNULIB_POSIXCHECK
# undef cnd_timedwait
# if HAVE_RAW_DECL_CND_TIMEDWAIT
_GL_WARN_ON_USE (cnd_timedwait, "cnd_timedwait is unportable - "
                 "use gnulib module cnd for portability");
# endif
#endif

#if @GNULIB_CND@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (cnd_signal, int, (cnd_t *) _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (cnd_signal, int, (cnd_t *));
_GL_CXXALIASWARN (cnd_signal);
#elif defined GNULIB_POSIXCHECK
# undef cnd_signal
# if HAVE_RAW_DECL_CND_SIGNAL
_GL_WARN_ON_USE (cnd_signal, "cnd_signal is unportable - "
                 "use gnulib module cnd for portability");
# endif
#endif

#if @GNULIB_CND@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (cnd_broadcast, int, (cnd_t *) _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (cnd_broadcast, int, (cnd_t *));
_GL_CXXALIASWARN (cnd_broadcast);
#elif defined GNULIB_POSIXCHECK
# undef cnd_broadcast
# if HAVE_RAW_DECL_CND_BROADCAST
_GL_WARN_ON_USE (cnd_broadcast, "cnd_broadcast is unportable - "
                 "use gnulib module cnd for portability");
# endif
#endif

#if @GNULIB_CND@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (cnd_destroy, void, (cnd_t *) _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (cnd_destroy, void, (cnd_t *));
_GL_CXXALIASWARN (cnd_destroy);
#elif defined GNULIB_POSIXCHECK
# undef cnd_destroy
# if HAVE_RAW_DECL_CND_DESTROY
_GL_WARN_ON_USE (cnd_destroy, "cnd_destroy is unportable - "
                 "use gnulib module cnd for portability");
# endif
#endif


/* =========== ISO C 11 7.26.6 Thread-specific storage functions =========== */

#if !@HAVE_THREADS_H@

# if defined _WIN32 && ! defined __CYGWIN__
/* Use Windows threads.  */

#  include "windows-tls.h"

typedef glwthread_tls_key_t tss_t;
#  define TSS_DTOR_ITERATIONS GLWTHREAD_DESTRUCTOR_ITERATIONS

# else
/* Use POSIX threads.  */

#  include <limits.h>

typedef pthread_key_t tss_t;

# endif

/* Type for the destructor of a thread-specific storage pointer.  */
typedef void (*tss_dtor_t) (void *);

#endif

/* AIX 7.1 <threads.h> does not define TSS_DTOR_ITERATIONS.  */
#ifndef TSS_DTOR_ITERATIONS
# ifdef PTHREAD_DESTRUCTOR_ITERATIONS
#  define TSS_DTOR_ITERATIONS PTHREAD_DESTRUCTOR_ITERATIONS
# else
   /* IRIX 6.5 does not define PTHREAD_DESTRUCTOR_ITERATIONS.
      This value is a wild guess.  */
#  define TSS_DTOR_ITERATIONS 1
# endif
#endif

#if @GNULIB_TSS@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (tss_create, int, (tss_t *, tss_dtor_t) _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (tss_create, int, (tss_t *, tss_dtor_t));
_GL_CXXALIASWARN (tss_create);
#elif defined GNULIB_POSIXCHECK
# undef tss_create
# if HAVE_RAW_DECL_TSS_CREATE
_GL_WARN_ON_USE (tss_create, "tss_create is unportable - "
                 "use gnulib module tss for portability");
# endif
#endif

#if @GNULIB_TSS@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (tss_set, int, (tss_t, void *));
# endif
_GL_CXXALIAS_SYS (tss_set, int, (tss_t, void *));
_GL_CXXALIASWARN (tss_set);
#elif defined GNULIB_POSIXCHECK
# undef tss_set
# if HAVE_RAW_DECL_TSS_SET
_GL_WARN_ON_USE (tss_set, "tss_set is unportable - "
                 "use gnulib module tss for portability");
# endif
#endif

#if @GNULIB_TSS@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (tss_get, void *, (tss_t));
# endif
_GL_CXXALIAS_SYS (tss_get, void *, (tss_t));
_GL_CXXALIASWARN (tss_get);
#elif defined GNULIB_POSIXCHECK
# undef tss_get
# if HAVE_RAW_DECL_TSS_GET
_GL_WARN_ON_USE (tss_get, "tss_get is unportable - "
                 "use gnulib module tss for portability");
# endif
#endif

#if @GNULIB_TSS@
# if !@HAVE_THREADS_H@
_GL_FUNCDECL_SYS (tss_delete, void, (tss_t));
# endif
_GL_CXXALIAS_SYS (tss_delete, void, (tss_t));
_GL_CXXALIASWARN (tss_delete);
#elif defined GNULIB_POSIXCHECK
# undef tss_delete
# if HAVE_RAW_DECL_TSS_DELETE
_GL_WARN_ON_USE (tss_delete, "tss_delete is unportable - "
                 "use gnulib module tss for portability");
# endif
#endif


#endif /* _@GUARD_PREFIX@_THREADS_H */
#endif /* _@GUARD_PREFIX@_THREADS_H */