Mercurial > gnulib
annotate m4/lock.m4 @ 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 |
rev | line source |
---|---|
18647
9c7c6767d0f6
lock: Provide guarantee to avoid writer starvation for rwlocks.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
1 # lock.m4 serial 14 |
40057
b06060465f09
maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents:
19484
diff
changeset
|
2 dnl Copyright (C) 2005-2019 Free Software Foundation, Inc. |
5994 | 3 dnl This file is free software; the Free Software Foundation |
4 dnl gives unlimited permission to copy and/or distribute it, | |
5 dnl with or without modifications, as long as this notice is preserved. | |
6 | |
7 dnl From Bruno Haible. | |
8 | |
10320 | 9 AC_DEFUN([gl_LOCK], |
7397
205d15e72fe9
Make it possible to invoke AC_GNU_SOURCE after gl_LOCK_EARLY.
Bruno Haible <bruno@clisp.org>
parents:
7357
diff
changeset
|
10 [ |
10320 | 11 AC_REQUIRE([gl_THREADLIB]) |
12 if test "$gl_threads_api" = posix; then | |
16935
498a2211d839
Write "Mac OS X" instead of "MacOS X".
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
13 # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the |
10320 | 14 # pthread_rwlock_* functions. |
18647
9c7c6767d0f6
lock: Provide guarantee to avoid writer starvation for rwlocks.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
15 has_rwlock=false |
10320 | 16 AC_CHECK_TYPE([pthread_rwlock_t], |
18647
9c7c6767d0f6
lock: Provide guarantee to avoid writer starvation for rwlocks.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
17 [has_rwlock=true |
9c7c6767d0f6
lock: Provide guarantee to avoid writer starvation for rwlocks.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
18 AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1], |
10320 | 19 [Define if the POSIX multithreading library has read/write locks.])], |
20 [], | |
21 [#include <pthread.h>]) | |
18647
9c7c6767d0f6
lock: Provide guarantee to avoid writer starvation for rwlocks.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
22 if $has_rwlock; then |
9c7c6767d0f6
lock: Provide guarantee to avoid writer starvation for rwlocks.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
23 gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER |
9c7c6767d0f6
lock: Provide guarantee to avoid writer starvation for rwlocks.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
24 fi |
10320 | 25 # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. |
13577
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
26 AC_COMPILE_IFELSE([ |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
27 AC_LANG_PROGRAM( |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
28 [[#include <pthread.h>]], |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
29 [[ |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
30 #if __FreeBSD__ == 4 |
5994 | 31 error "No, in FreeBSD 4.0 recursive mutexes actually don't work." |
17388
c2f3bfaf5fce
lock: work around pthread recursive mutexes bug in Mac OS X 10.6
Daiki Ueno <ueno@gnu.org>
parents:
17249
diff
changeset
|
32 #elif (defined __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ \ |
c2f3bfaf5fce
lock: work around pthread recursive mutexes bug in Mac OS X 10.6
Daiki Ueno <ueno@gnu.org>
parents:
17249
diff
changeset
|
33 && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) |
c2f3bfaf5fce
lock: work around pthread recursive mutexes bug in Mac OS X 10.6
Daiki Ueno <ueno@gnu.org>
parents:
17249
diff
changeset
|
34 error "No, in Mac OS X < 10.7 recursive mutexes actually don't work." |
5994 | 35 #else |
36 int x = (int)PTHREAD_MUTEX_RECURSIVE; | |
7357
28f050736570
Avoid warning at configure time with "gcc -Wall".
Bruno Haible <bruno@clisp.org>
parents:
7188
diff
changeset
|
37 return !x; |
13577
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
38 #endif |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
39 ]])], |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
10320
diff
changeset
|
40 [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], [1], |
10320 | 41 [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])]) |
5994 | 42 fi |
43 gl_PREREQ_LOCK | |
44 ]) | |
45 | |
17182
10268a7a6854
cond, lock, thread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
16935
diff
changeset
|
46 # Prerequisites of lib/glthread/lock.c. |
10268a7a6854
cond, lock, thread: better 'inline'
Paul Eggert <eggert@cs.ucla.edu>
parents:
16935
diff
changeset
|
47 AC_DEFUN([gl_PREREQ_LOCK], [:]) |