1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2025-08-14 14:01:48 +03:00
Commit Graph

12 Commits

Author SHA1 Message Date
Bruno Haible
6361efe6e2 lock tests: Fix build failure on z/OS.
Reported by Daniel Richard G. <skunk@iskunk.org>.
* modules/lock-tests (configure.ac): Test for <semaphore.h>.
* tests/test-lock.c (USE_SEMAPHORE): Don't set if <semaphore.h> does not
exist.
2017-02-20 22:34:24 +01:00
Bruno Haible
b6acb8db44 lock tests: Fix link error.
* modules/lock-tests (test_rwlock1_LDADD): Add @YIELD_LIB@.
Reported by Tom G. Christensen <tgc@jupiterrise.com>.
2017-02-01 22:47:27 +01:00
Bruno Haible
be95b17ae9 lock: Provide guarantee to avoid writer starvation for rwlocks.
The rationale is: 1) Read-preferring read-write locks are prone to
writer starvation if the number of reader threads multiplied by the
percentage of time they have the lock held is too high. 2) Write-
preferring read-write locks are the only reliable way to avoid this.
3) There have been reports of 'test-lock' hanging on glibc systems
http://lists.gnu.org/archive/html/bug-gnulib/2017-01/msg00009.html,
and glibc indeed implements read-preferring rwlocks by default, see
http://man7.org/linux/man-pages/man3/pthread_rwlockattr_setkind_np.3.html
and https://sourceware.org/bugzilla/show_bug.cgi?id=13701 .

* m4/pthread_rwlock_rdlock.m4: New file.
* m4/lock.m4 (gl_LOCK): Invoke gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER.
* lib/glthread/lock.h [USE_POSIX_THREADS]: Test
HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER. Use a different implementation
of rwlock initialization on glibc systems without
HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER. Use a different implementation
of rwlocks altogether on non-glibc systems without
HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER.
[USE_PTH_THREADS]: Use a different implementation of rwlocks altogether.
* lib/glthread/lock.c [USE_POSIX_THREADS]
(glthread_rwlock_init_for_glibc): New function.
[USE_POSIX_THREADS] (glthread_rwlock_rdlock_multithreaded): Update
comment.
[USE_PTH_THREADS]: New implementation of rwlocks.
[USE_WINDOWS_THREADS] (glthread_rwlock_rdlock_func): Prefer writers over
readers.
* modules/lock (Files): Add m4/pthread_rwlock_rdlock.m4.
(Depends-on): Add 'extensions'.
* tests/test-rwlock1.c: New file.
* lock-tests (Files): Add it.
(Depends-on): Add usleep.
(Makefile.am): Add test-rwlock1 to the tests.
2017-01-05 12:51:36 +01:00
Bruno Haible
37fbb99a4f Make use of the modules 'thread', 'yield' in the 'lock' test. 2008-10-01 02:40:17 +02:00
Bruno Haible
dcf49e3510 Undo unintentional commit. 2008-08-31 00:01:36 +02:00
Bruno Haible
c2318e8859 Avoid some "gcc -pedantic" warnings. 2008-08-30 03:09:15 +02:00
Eric Blake
026ecefff9 Fix --with-tests compilation on cygwin.
* modules/argmatch-tests (Makefile.am): List gnulib library first
in LDADD.
* modules/argp-tests (Makefile.am): Likewise.
* modules/array-list-tests (Makefile.am): Likewise.
* modules/array-oset-tests (Makefile.am): Likewise.
* modules/avltree-list-tests (Makefile.am): Likewise.
* modules/avltree-oset-tests (Makefile.am): Likewise.
* modules/avltreehash-list-tests (Makefile.am): Likewise.
* modules/carray-list-tests (Makefile.am): Likewise.
* modules/dirname-tests (Makefile.am): Likewise.
* modules/frexp-tests (Makefile.am): Likewise.
* modules/isnanl-tests (Makefile.am): Likewise.
* modules/linked-list-tests (Makefile.am): Likewise.
* modules/linkedhash-list-tests (Makefile.am): Likewise.
* modules/lock-tests (Makefile.am): Likewise.
* modules/rbtree-list-tests (Makefile.am): Likewise.
* modules/rbtree-oset-tests (Makefile.am): Likewise.
* modules/rbtreehash-list-tests (Makefile.am): Likewise.
* modules/tls-tests (Makefile.am): Likewise.
* modules/tsearch-tests (Makefile.am): Likewise.
* modules/xvasprintf-tests (Makefile.am): Likewise.
2007-04-16 22:58:16 +00:00
Bruno Haible
75032ae61b Try harder to find sched_yield on Solaris. 2007-04-13 12:14:00 +00:00
Bruno Haible
563ea91ac9 Assume automake >= 1.10. 2007-02-25 13:22:57 +00:00
Paul Eggert
bb469ee630 * modules/xstrtod: Omit xstrtod.h, xstrtod.c; they're in LIB_SOURCES.
* modules/lock-tests (TESTS): Use $(EXEEXT).
* modules/tls-tests: Likewise.
* modules/argp-tests: Likewise.
(check_PROGRAMS): New var, replacing...
(noinst_PROGRAMS, test_argp_SOURCES): Remove.
2006-02-25 05:07:39 +00:00
Bruno Haible
740b6ed284 Simplify. 2006-01-23 20:38:51 +00:00
Bruno Haible
271b13d611 Tests for gnulib module 'lock'. 2005-08-25 12:36:58 +00:00