Mercurial > hg > octave-shane > gnulib-hg
annotate lib/pthread.in.h @ 16366:bb182ee4a09d
maint: replace FSF snail-mail addresses with URLs
* config/argz.mk, lib/accept4.c, lib/alignof.h, lib/alloca.in.h:
* lib/alphasort.c, lib/arcfour.c, lib/arcfour.h, lib/arctwo.c:
* lib/arctwo.h, lib/argz.c, lib/arpa_inet.in.h, lib/asnprintf.c:
* lib/asprintf.c, lib/assert.in.h, lib/base32.c, lib/base32.h:
* lib/base64.c, lib/base64.h, lib/c-ctype.c, lib/c-ctype.h:
* lib/c-strcase.h, lib/c-strcasecmp.c, lib/c-strncasecmp.c:
* lib/check-version.c, lib/check-version.h, lib/config.charset:
* lib/ctype.in.h, lib/des.c, lib/des.h, lib/dup3.c, lib/errno.in.h:
* lib/float+.h, lib/fnmatch.c, lib/fnmatch.in.h, lib/fnmatch_loop.c:
* lib/fseeko.c, lib/gai_strerror.c, lib/gc-gnulib.c:
* lib/gc-libgcrypt.c, lib/gc-pbkdf2-sha1.c, lib/gc.h:
* lib/getaddrinfo.c, lib/getdelim.c, lib/getfilecon.c, lib/getline.c:
* lib/getlogin_r.c, lib/getpass.c, lib/getpass.h, lib/gettext.h:
* lib/gettimeofday.c, lib/glob.in.h, lib/glthread/cond.c:
* lib/glthread/cond.h, lib/glthread/lock.c, lib/glthread/lock.h:
* lib/glthread/thread.c, lib/glthread/thread.h:
* lib/glthread/threadlib.c, lib/glthread/yield.h, lib/hmac-md5.c:
* lib/hmac-sha1.c, lib/hmac.h, lib/iconv.c, lib/iconv.in.h:
* lib/iconv_close.c, lib/iconv_open.c, lib/inet_ntop.c, lib/isfinite.c:
* lib/isinf.c, lib/iswblank.c, lib/langinfo.in.h, lib/link.c:
* lib/localcharset.c, lib/localcharset.h, lib/lseek.c, lib/malloc.c:
* lib/malloca.c, lib/malloca.h, lib/md2.c, lib/md2.h, lib/md4.c:
* lib/md4.h, lib/md5.c, lib/md5.h, lib/memmem.c, lib/mempcpy.c:
* lib/memset.c, lib/memxor.c, lib/memxor.h, lib/minmax.h, lib/mktime.c:
* lib/msvc-inval.c, lib/msvc-inval.h, lib/msvc-nothrow.c:
* lib/msvc-nothrow.h, lib/netdb.in.h, lib/netinet_in.in.h, lib/nproc.c:
* lib/nproc.h, lib/obstack_printf.c, lib/pathmax.h, lib/pipe.c:
* lib/pipe2.c, lib/poll.c, lib/poll.in.h, lib/printf-args.c:
* lib/printf-args.h, lib/printf-parse.c, lib/printf-parse.h:
* lib/pselect.c, lib/pthread.in.h, lib/pty-private.h, lib/pty.in.h:
* lib/read-file.c, lib/read-file.h, lib/ref-add.sin, lib/ref-del.sin:
* lib/regcomp.c, lib/regex.c, lib/regex.h, lib/regex_internal.c:
* lib/regex_internal.h, lib/regexec.c, lib/rijndael-alg-fst.c:
* lib/rijndael-alg-fst.h, lib/rijndael-api-fst.c:
* lib/rijndael-api-fst.h, lib/rint.c, lib/rintf.c, lib/rintl.c:
* lib/round.c, lib/roundf.c, lib/roundl.c, lib/scandir.c, lib/select.c:
* lib/sha1.c, lib/sha1.h, lib/size_max.h, lib/snprintf.c:
* lib/stdalign.in.h, lib/stdarg.in.h, lib/stdbool.in.h:
* lib/stddef.in.h, lib/stdint.in.h, lib/stdio.in.h, lib/str-kmp.h:
* lib/str-two-way.h, lib/strcasecmp.c, lib/strcasestr.c, lib/strdup.c:
* lib/striconv.c, lib/striconv.h, lib/string.in.h, lib/strings.in.h:
* lib/strncasecmp.c, lib/strndup.c, lib/strnlen.c, lib/strpbrk.c:
* lib/strptime.c, lib/strsep.c, lib/strstr.c, lib/strverscmp.c:
* lib/sys_file.in.h, lib/sys_ioctl.in.h, lib/sys_select.in.h:
* lib/sys_socket.in.h, lib/sys_stat.in.h, lib/sys_time.in.h:
* lib/sys_times.in.h, lib/sys_types.in.h, lib/sys_uio.in.h:
* lib/sys_utsname.in.h, lib/sys_wait.in.h, lib/tcgetsid.c:
* lib/termios.in.h, lib/time.in.h, lib/time_r.c, lib/timegm.c:
* lib/times.c, lib/unictype/3level.h, lib/unictype/3levelbit.h:
* lib/unistd.in.h, lib/vasnprintf.c, lib/vasnprintf.h, lib/vasprintf.c:
* lib/vsnprintf.c, lib/waitpid.c, lib/wchar.in.h, lib/wctype.in.h:
* lib/xsize.h, tests/test-closein.c, tests/test-des.c:
* tests/test-fclose.c, tests/test-fgetc.c, tests/test-filevercmp.c:
* tests/test-fputc.c, tests/test-fread.c, tests/test-fwrite.c:
* tests/test-gc-arcfour.c, tests/test-gc-arctwo.c, tests/test-gc-des.c:
* tests/test-gc-hmac-md5.c, tests/test-gc-hmac-sha1.c:
* tests/test-gc-md2.c, tests/test-gc-md4.c, tests/test-gc-md5.c:
* tests/test-gc-pbkdf2-sha1.c, tests/test-gc-rijndael.c:
* tests/test-gc-sha1.c, tests/test-gc.c, tests/test-getdelim.c:
* tests/test-getline.c, tests/test-getndelim2.c, tests/test-md2.c:
* tests/test-md4.c, tests/test-parse-datetime.c, tests/test-perror.c:
* tests/test-perror2.c, tests/test-pipe.c, tests/test-pipe2.c:
* tests/test-poll.c, tests/test-quotearg-simple.c:
* tests/test-quotearg.c, tests/test-quotearg.h:
* tests/test-round-ieee.c, tests/test-round1.c:
* tests/test-roundf-ieee.c, tests/test-roundf1.c:
* tests/test-roundl-ieee.c, tests/test-roundl.c:
* tests/test-safe-alloc.c, tests/test-sigpipe.c:
* tests/test-spawn-pipe-child.c, tests/test-spawn-pipe-main.c:
* tests/test-strerror.c, tests/test-strerror_r.c:
* tests/test-strsignal.c, tests/test-strverscmp.c:
* tests/test-xmemdup0.c:
Replace FSF snail mail addresses with URLs, as per GNU coding
standards. See glibc bug
<http://sourceware.org/bugzilla/show_bug.cgi?id=13673>.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Thu, 09 Feb 2012 21:39:05 -0800 |
parents | 8250f2777afc |
children | 8b10fbdb551e |
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 | 2 |
16201
8250f2777afc
maint: update all copyright year number ranges
Jim Meyering <meyering@redhat.com>
parents:
14840
diff
changeset
|
3 Copyright (C) 2009-2012 Free Software Foundation, Inc. |
11431 | 4 |
5 This program is free software; you can redistribute it and/or modify | |
6 it under the terms of the GNU General Public License as published by | |
7 the Free Software Foundation; either version 2, or (at your option) | |
8 any later version. | |
9 | |
10 This program is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 GNU General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU General Public License | |
16366
bb182ee4a09d
maint: replace FSF snail-mail addresses with URLs
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
16 along with this program; if not, see <http://www.gnu.org/licenses/>. */ |
11431 | 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 |
14840
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14274
diff
changeset
|
20 #ifndef _@GUARD_PREFIX@_PTHREAD_H_ |
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
|
21 |
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 #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
|
23 @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
|
24 #endif |
13761
a19ace3ba849
Avoid line length limitation from HP NonStop system header files.
Bruno Haible <bruno@clisp.org>
parents:
13717
diff
changeset
|
25 @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
|
26 |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
27 /* The include_next requires a split double-inclusion guard. */ |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
28 #if @HAVE_PTHREAD_H@ |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
29 # @INCLUDE_NEXT@ @NEXT_PTHREAD_H@ |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
30 #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
|
31 |
14840
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14274
diff
changeset
|
32 #ifndef _@GUARD_PREFIX@_PTHREAD_H_ |
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14274
diff
changeset
|
33 #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
|
34 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
35 #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
|
36 #include <stdlib.h> |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
37 #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
|
38 #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
|
39 #include <time.h> |
11431 | 40 |
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
|
41 #if ! @HAVE_PTHREAD_T@ |
14274
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
42 # 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
|
43 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
|
44 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
|
45 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
|
46 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
|
47 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
|
48 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
|
49 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
|
50 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
|
51 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
|
52 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
|
53 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
|
54 typedef int pthread_rwlockattr_t; |
14274
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
55 # define GNULIB_defined_pthread_types 1 |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
56 # endif |
13467
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
57 #endif |
11431 | 58 |
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
|
59 #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
|
60 #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
|
61 #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
|
62 #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
|
63 #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
|
64 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
65 #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
|
66 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
67 #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
|
68 #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
|
69 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
70 #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
|
71 #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
|
72 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
73 #define PTHREAD_CANCELED ((void *) -1) |
11431 | 74 |
13467
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
75 #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
|
76 #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
|
77 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
78 #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
|
79 #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
|
80 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
81 #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
|
82 #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
|
83 #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
|
84 #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
|
85 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
86 #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
|
87 #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
|
88 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
89 #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
|
90 #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
|
91 #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
|
92 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
93 #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
|
94 #define PTHREAD_PROCESS_SHARED 1 |
11431 | 95 |
13467
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
96 #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
|
97 #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
|
98 #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
|
99 |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
100 #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
|
101 |
14274
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
102 # if !GNULIB_defined_pthread_functions |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
103 |
13467
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
104 /* 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
|
105 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
|
106 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
|
107 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
|
108 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
109 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
|
110 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
|
111 now. */ |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
112 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
113 static inline int |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
114 pthread_cond_destroy (pthread_cond_t *cond) |
11431 | 115 { |
13467
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
116 /* 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
|
117 return 0; |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
118 } |
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 static inline int |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
121 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
|
122 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
|
123 { |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
124 /* 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
|
125 return 0; |
11431 | 126 } |
127 | |
13467
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
128 static inline int |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
129 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
|
130 { |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
131 /* 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
|
132 return 0; |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
133 } |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
134 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
135 static inline int |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
136 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
|
137 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
|
138 { |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
139 /* 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
|
140 abort (); |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
141 return 0; |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
142 } |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
143 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
144 static inline int |
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 (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
|
146 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
|
147 void * (*start_routine) (void*), void *restrict arg) |
11431 | 148 { |
13467
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
149 /* 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
|
150 return EAGAIN; |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
151 } |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
152 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
153 static inline void |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
154 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
|
155 { |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
156 /* 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
|
157 exit (0); |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
158 } |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
159 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
160 static inline int |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
161 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
|
162 { |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
163 /* Properly-written applications never come here. */ |
11431 | 164 abort (); |
13467
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
165 return 0; |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
166 } |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
167 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
168 static 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
|
169 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
|
170 { |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
171 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
|
172 } |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
173 |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
174 static inline int |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
175 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
|
176 { |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
177 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
|
178 } |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
179 |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
180 static inline int |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
181 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
|
182 { |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
183 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
|
184 } |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
185 |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
186 static 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
|
187 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
|
188 { |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
189 /* 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
|
190 return 0; |
11431 | 191 } |
192 | |
13467
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
193 static inline int |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
194 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
|
195 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
|
196 { |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
197 /* 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
|
198 return 0; |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
199 } |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
200 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
201 static inline int |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
202 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
|
203 { |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
204 /* 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
|
205 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
|
206 return 0; |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
207 } |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
208 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
209 static 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
|
210 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
|
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 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
|
213 } |
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 |
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 static 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
|
216 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
|
217 { |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
218 /* 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
|
219 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
|
220 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
|
221 return 0; |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
222 } |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
223 |
14274
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
224 # define GNULIB_defined_pthread_functions 1 |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
225 # endif |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
226 |
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
|
227 #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
|
228 |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
229 #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
|
230 |
14274
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
231 # if !GNULIB_defined_pthread_spinlock_t |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
232 |
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
|
233 /* 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
|
234 |
b747a553a8bb
pthread: add to system <pthread.h> instead of replacing it all, for MacOS
Paul Eggert <eggert@cs.ucla.edu>
parents:
13706
diff
changeset
|
235 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
|
236 |
13467
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
237 static inline int |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
238 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
|
239 { |
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
|
240 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
|
241 } |
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 static inline int |
13706
b236a91e37b9
pthread: add pthread_spin_destroy
Paul Eggert <eggert@cs.ucla.edu>
parents:
13479
diff
changeset
|
244 pthread_spin_destroy (pthread_spinlock_t *lock) |
b236a91e37b9
pthread: add pthread_spin_destroy
Paul Eggert <eggert@cs.ucla.edu>
parents:
13479
diff
changeset
|
245 { |
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
|
246 return pthread_mutex_destroy (lock); |
13706
b236a91e37b9
pthread: add pthread_spin_destroy
Paul Eggert <eggert@cs.ucla.edu>
parents:
13479
diff
changeset
|
247 } |
b236a91e37b9
pthread: add pthread_spin_destroy
Paul Eggert <eggert@cs.ucla.edu>
parents:
13479
diff
changeset
|
248 |
b236a91e37b9
pthread: add pthread_spin_destroy
Paul Eggert <eggert@cs.ucla.edu>
parents:
13479
diff
changeset
|
249 static 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
|
250 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
|
251 { |
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
|
252 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
|
253 } |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
254 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
255 static inline int |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
256 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
|
257 { |
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
|
258 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
|
259 } |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
260 |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
261 static inline int |
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
262 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
|
263 { |
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
|
264 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
|
265 } |
14274
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
266 |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
267 # define GNULIB_defined_pthread_spinlock_t 1 |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
268 # endif |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
269 |
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
|
270 #endif |
13467
b3e78c51aab6
pthread: Add enough so that coreutils/src/sort.c compiles.
Paul R. Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
271 |
14840
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14274
diff
changeset
|
272 #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */ |
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14274
diff
changeset
|
273 #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */ |