annotate lib/pthread.in.h @ 40196:e63f5d3edab5

relocatable-prog: Update documentation. * doc/relocatable-maint.texi (Supporting Relocation): Update to match the recent changes.
author Bruno Haible <bruno@clisp.org>
date Sun, 24 Feb 2019 01:49:15 +0100
parents b06060465f09
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
1 /* Implement a trivial subset of POSIX 1003.1-2008 pthread.h.
11431
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
2
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19667
diff changeset
3 Copyright (C) 2009-2019 Free Software Foundation, Inc.
11431
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
4
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
5 This program is free software; you can redistribute it and/or modify
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
7 the Free Software Foundation; either version 2, or (at your option)
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
8 any later version.
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
9
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
13 GNU General Public License for more details.
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
14
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
19190
9759915b2aca all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 18626
diff changeset
16 along with this program; if not, see <https://www.gnu.org/licenses/>. */
11431
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
17
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
18 /* Written by Paul Eggert and Glen Lenker. */
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
19
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
20 #if __GNUC__ >= 3
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
21 @PRAGMA_SYSTEM_HEADER@
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
22 #endif
13761
a19ace3ba849 Avoid line length limitation from HP NonStop system header files.
Bruno Haible <bruno@clisp.org>
parents: 13717
diff changeset
23 @PRAGMA_COLUMNS@
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
24
19667
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
25 #if defined _GL_ALREADY_INCLUDING_PTHREAD_H
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
26 /* Special invocation convention:
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
27 On Android, we have a sequence of nested includes
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
28 <pthread.h> -> <time.h> -> <sys/time.h> -> <sys/select.h> ->
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
29 <signal.h> -> <pthread.h>.
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
30 In this situation, PTHREAD_COND_INITIALIZER is not yet defined,
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
31 therefore we should not attempt to define PTHREAD_MUTEX_NORMAL etc. */
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
32
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
33 #@INCLUDE_NEXT@ @NEXT_PTHREAD_H@
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
34
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
35 #else
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
36 /* Normal invocation convention. */
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
37
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
38 #ifndef _@GUARD_PREFIX@_PTHREAD_H_
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
39
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
40 #if @HAVE_PTHREAD_H@
19667
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
41
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
42 # define _GL_ALREADY_INCLUDING_PTHREAD_H
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
43
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
44 /* The include_next requires a split double-inclusion guard. */
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
45 # @INCLUDE_NEXT@ @NEXT_PTHREAD_H@
19667
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
46
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
47 # undef _GL_ALREADY_INCLUDING_PTHREAD_H
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
48
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
49 #endif
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
50
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14274
diff changeset
51 #ifndef _@GUARD_PREFIX@_PTHREAD_H_
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14274
diff changeset
52 #define _@GUARD_PREFIX@_PTHREAD_H_
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
53
17277
b83fbc95abc4 stdlib: port to Solaris 2.6
Paul Eggert <eggert@cs.ucla.edu>
parents: 17249
diff changeset
54 #define __need_system_stdlib_h
b83fbc95abc4 stdlib: port to Solaris 2.6
Paul Eggert <eggert@cs.ucla.edu>
parents: 17249
diff changeset
55 #include <stdlib.h>
b83fbc95abc4 stdlib: port to Solaris 2.6
Paul Eggert <eggert@cs.ucla.edu>
parents: 17249
diff changeset
56 #undef __need_system_stdlib_h
b83fbc95abc4 stdlib: port to Solaris 2.6
Paul Eggert <eggert@cs.ucla.edu>
parents: 17249
diff changeset
57
17604
736140c38a15 pthread: work around winpthread header pollution on mingw
Eric Blake <eblake@redhat.com>
parents: 17576
diff changeset
58
736140c38a15 pthread: work around winpthread header pollution on mingw
Eric Blake <eblake@redhat.com>
parents: 17576
diff changeset
59 /* The pthreads-win32 <pthread.h> defines a couple of broken macros. */
736140c38a15 pthread: work around winpthread header pollution on mingw
Eric Blake <eblake@redhat.com>
parents: 17576
diff changeset
60 #undef asctime_r
736140c38a15 pthread: work around winpthread header pollution on mingw
Eric Blake <eblake@redhat.com>
parents: 17576
diff changeset
61 #undef ctime_r
736140c38a15 pthread: work around winpthread header pollution on mingw
Eric Blake <eblake@redhat.com>
parents: 17576
diff changeset
62 #undef gmtime_r
736140c38a15 pthread: work around winpthread header pollution on mingw
Eric Blake <eblake@redhat.com>
parents: 17576
diff changeset
63 #undef localtime_r
736140c38a15 pthread: work around winpthread header pollution on mingw
Eric Blake <eblake@redhat.com>
parents: 17576
diff changeset
64 #undef rand_r
736140c38a15 pthread: work around winpthread header pollution on mingw
Eric Blake <eblake@redhat.com>
parents: 17576
diff changeset
65 #undef strtok_r
736140c38a15 pthread: work around winpthread header pollution on mingw
Eric Blake <eblake@redhat.com>
parents: 17576
diff changeset
66
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
67 #include <errno.h>
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
68 #include <sched.h>
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
69 #include <sys/types.h>
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
70 #include <time.h>
11431
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
71
17473
1f9070ef79b0 headers: check that _GL_INLINE_HEADER_BEGIN is defined
Paul Eggert <eggert@cs.ucla.edu>
parents: 17277
diff changeset
72 #ifndef _GL_INLINE_HEADER_BEGIN
1f9070ef79b0 headers: check that _GL_INLINE_HEADER_BEGIN is defined
Paul Eggert <eggert@cs.ucla.edu>
parents: 17277
diff changeset
73 #error "Please include config.h first."
1f9070ef79b0 headers: check that _GL_INLINE_HEADER_BEGIN is defined
Paul Eggert <eggert@cs.ucla.edu>
parents: 17277
diff changeset
74 #endif
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
75 _GL_INLINE_HEADER_BEGIN
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
76 #ifndef _GL_PTHREAD_INLINE
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
77 # define _GL_PTHREAD_INLINE _GL_INLINE
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
78 #endif
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
79
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
80 #if ! @HAVE_PTHREAD_T@
14274
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
81 # if !GNULIB_defined_pthread_types
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
82 typedef int pthread_t;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
83 typedef int pthread_attr_t;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
84 typedef int pthread_barrier_t;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
85 typedef int pthread_barrierattr_t;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
86 typedef int pthread_cond_t;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
87 typedef int pthread_condattr_t;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
88 typedef int pthread_key_t;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
89 typedef int pthread_mutex_t;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
90 typedef int pthread_mutexattr_t;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
91 typedef int pthread_once_t;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
92 typedef int pthread_rwlock_t;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
93 typedef int pthread_rwlockattr_t;
14274
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
94 # define GNULIB_defined_pthread_types 1
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
95 # endif
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
96 #endif
11431
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
97
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
98 #ifndef PTHREAD_COND_INITIALIZER
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
99 #define PTHREAD_COND_INITIALIZER { 0 }
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
100 #define PTHREAD_MUTEX_INITIALIZER { 0 }
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
101 #define PTHREAD_ONCE_INIT { 0 }
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
102 #define PTHREAD_RWLOCK_INITIALIZER { 0 }
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
103
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
104 #define PTHREAD_BARRIER_SERIAL_THREAD (-1)
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
105
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
106 #define PTHREAD_CANCEL_DEFERRED 0
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
107 #define PTHREAD_CANCEL_ASYNCHRONOUS 1
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
108
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
109 #define PTHREAD_CANCEL_ENABLE 0
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
110 #define PTHREAD_CANCEL_DISABLE 1
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
111
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
112 #define PTHREAD_CANCELED ((void *) -1)
11431
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
113
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
114 #define PTHREAD_CREATE_JOINABLE 0
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
115 #define PTHREAD_CREATE_DETACHED 1
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
116
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
117 #define PTHREAD_INHERIT_SCHED 0
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
118 #define PTHREAD_EXPLICIT_SCHED 1
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
119
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
120 #define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
121 #define PTHREAD_MUTEX_NORMAL 0
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
122 #define PTHREAD_MUTEX_ERRORCHECK 1
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
123 #define PTHREAD_MUTEX_RECURSIVE 2
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
124
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
125 #define PTHREAD_MUTEX_STALLED 0
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
126 #define PTHREAD_MUTEX_ROBUST 1
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
127
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
128 #define PTHREAD_PRIO_NONE 0
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
129 #define PTHREAD_PRIO_INHERIT 1
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
130 #define PTHREAD_PRIO_PROTECT 2
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
131
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
132 #define PTHREAD_PROCESS_PRIVATE 0
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
133 #define PTHREAD_PROCESS_SHARED 1
11431
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
134
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
135 #define PTHREAD_SCOPE_SYSTEM 0
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
136 #define PTHREAD_SCOPE_PROCESS 1
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
137 #endif
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
138
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
139 #if ! @HAVE_PTHREAD_T@
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
140
14274
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
141 # if !GNULIB_defined_pthread_functions
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
142
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
143 /* Provide substitutes for the thread functions that should work
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
144 adequately on a single-threaded implementation, where
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
145 pthread_create always fails. The goal is to let programs compile
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
146 on non-pthread hosts with minimal runtime overhead.
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
147
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
148 Omit interfaces that have not been analyzed and for which we do not
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
149 know what to do, so that they elicit a compile-time error for
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
150 now. */
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
151
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
152 _GL_PTHREAD_INLINE int
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
153 pthread_cond_destroy (pthread_cond_t *cond)
11431
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
154 {
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
155 /* COND is never seriously used. */
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
156 return 0;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
157 }
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
158
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
159 _GL_PTHREAD_INLINE int
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
160 pthread_cond_init (pthread_cond_t *restrict cond,
13479
8a0b8adde2be Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 13467
diff changeset
161 pthread_condattr_t const *restrict attr)
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
162 {
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
163 /* COND is never seriously used. */
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
164 return 0;
11431
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
165 }
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
166
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
167 _GL_PTHREAD_INLINE int
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
168 pthread_cond_signal (pthread_cond_t *cond)
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
169 {
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
170 /* No threads can currently be blocked on COND. */
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
171 return 0;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
172 }
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
173
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
174 _GL_PTHREAD_INLINE int
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
175 pthread_cond_wait (pthread_cond_t *restrict cond,
13479
8a0b8adde2be Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 13467
diff changeset
176 pthread_mutex_t *restrict mutex)
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
177 {
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
178 /* Properly-written applications never come here. */
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
179 abort ();
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
180 return 0;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
181 }
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
182
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
183 _GL_PTHREAD_INLINE int
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
184 pthread_create (pthread_t *restrict thread,
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
185 pthread_attr_t const *restrict attr,
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
186 void * (*start_routine) (void*), void *restrict arg)
11431
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
187 {
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
188 /* Do not create a thread. */
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
189 return EAGAIN;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
190 }
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
191
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
192 _GL_PTHREAD_INLINE void
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
193 pthread_exit (void *value)
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
194 {
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
195 /* There is just one thread, so the process exits. */
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
196 exit (0);
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
197 }
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
198
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
199 _GL_PTHREAD_INLINE int
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
200 pthread_join (pthread_t thread, void **pvalue)
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
201 {
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
202 /* Properly-written applications never come here. */
11431
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
203 abort ();
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
204 return 0;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
205 }
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
206
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
207 _GL_PTHREAD_INLINE int
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
208 pthread_mutexattr_destroy (pthread_mutexattr_t *attr)
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
209 {
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
210 return 0;
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
211 }
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
212
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
213 _GL_PTHREAD_INLINE int
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
214 pthread_mutexattr_init (pthread_mutexattr_t *attr)
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
215 {
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
216 return 0;
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
217 }
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
218
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
219 _GL_PTHREAD_INLINE int
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
220 pthread_mutexattr_settype (pthread_mutexattr_t *attr, int attr_type)
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
221 {
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
222 return 0;
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
223 }
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
224
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
225 _GL_PTHREAD_INLINE int
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
226 pthread_mutex_destroy (pthread_mutex_t *mutex)
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
227 {
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
228 /* MUTEX is never seriously used. */
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
229 return 0;
11431
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
230 }
4a2a6b0eadea New modules nproc, pthread.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
231
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
232 _GL_PTHREAD_INLINE int
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
233 pthread_mutex_init (pthread_mutex_t *restrict mutex,
13479
8a0b8adde2be Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 13467
diff changeset
234 pthread_mutexattr_t const *restrict attr)
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
235 {
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
236 /* MUTEX is never seriously used. */
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
237 return 0;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
238 }
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
239
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
240 _GL_PTHREAD_INLINE int
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
241 pthread_mutex_lock (pthread_mutex_t *mutex)
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
242 {
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
243 /* There is only one thread, so it always gets the lock. This
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
244 implementation does not support PTHREAD_MUTEX_ERRORCHECK. */
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
245 return 0;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
246 }
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
247
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
248 _GL_PTHREAD_INLINE int
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
249 pthread_mutex_trylock (pthread_mutex_t *mutex)
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
250 {
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
251 return pthread_mutex_lock (mutex);
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
252 }
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
253
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
254 _GL_PTHREAD_INLINE int
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
255 pthread_mutex_unlock (pthread_mutex_t *mutex)
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
256 {
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
257 /* There is only one thread, so it always unlocks successfully.
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
258 This implementation does not support robust mutexes or
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
259 PTHREAD_MUTEX_ERRORCHECK. */
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
260 return 0;
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
261 }
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
262
14274
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
263 # define GNULIB_defined_pthread_functions 1
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
264 # endif
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
265
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
266 #endif
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
267
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
268 #if ! @HAVE_PTHREAD_SPINLOCK_T@
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
269
14274
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
270 # if !GNULIB_defined_pthread_spinlock_t
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
271
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
272 /* Approximate spinlocks with mutexes. */
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
273
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
274 typedef pthread_mutex_t pthread_spinlock_t;
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
275
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
276 _GL_PTHREAD_INLINE int
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
277 pthread_spin_init (pthread_spinlock_t *lock, int pshared)
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
278 {
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
279 return pthread_mutex_init (lock, NULL);
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
280 }
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
281
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
282 _GL_PTHREAD_INLINE int
13706
b236a91e37b9 pthread: add pthread_spin_destroy
Paul Eggert <eggert@cs.ucla.edu>
parents: 13479
diff changeset
283 pthread_spin_destroy (pthread_spinlock_t *lock)
b236a91e37b9 pthread: add pthread_spin_destroy
Paul Eggert <eggert@cs.ucla.edu>
parents: 13479
diff changeset
284 {
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
285 return pthread_mutex_destroy (lock);
13706
b236a91e37b9 pthread: add pthread_spin_destroy
Paul Eggert <eggert@cs.ucla.edu>
parents: 13479
diff changeset
286 }
b236a91e37b9 pthread: add pthread_spin_destroy
Paul Eggert <eggert@cs.ucla.edu>
parents: 13479
diff changeset
287
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
288 _GL_PTHREAD_INLINE int
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
289 pthread_spin_lock (pthread_spinlock_t *lock)
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
290 {
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
291 return pthread_mutex_lock (lock);
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
292 }
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
293
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
294 _GL_PTHREAD_INLINE int
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
295 pthread_spin_trylock (pthread_spinlock_t *lock)
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
296 {
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
297 return pthread_mutex_trylock (lock);
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
298 }
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
299
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
300 _GL_PTHREAD_INLINE int
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
301 pthread_spin_unlock (pthread_spinlock_t *lock)
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
302 {
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
303 return pthread_mutex_unlock (lock);
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
304 }
14274
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
305
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
306 # define GNULIB_defined_pthread_spinlock_t 1
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
307 # endif
da5595160b9f Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
308
13717
b747a553a8bb pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents: 13706
diff changeset
309 #endif
13467
b3e78c51aab6 pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents: 12559
diff changeset
310
17169
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
311 _GL_INLINE_HEADER_END
8b10fbdb551e pthread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents: 16366
diff changeset
312
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14274
diff changeset
313 #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14274
diff changeset
314 #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
19667
1ff0dca052af pthread: Fix compilation error on Android.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
315 #endif