]> git.ipfire.org Git - thirdparty/gettext.git/commit
lock test: Fix performance problem on multi-core machines.
authorBruno Haible <bruno@clisp.org>
Mon, 2 Jan 2017 00:00:00 +0000 (01:00 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 2 Jan 2017 00:00:00 +0000 (01:00 +0100)
commit1afbcb06fded2a427b761dd1615b1e48e1e853cc
treef619c381741280fa392c6888791952dda284646b
parent3e1b7955c1f95428a974b6f335c62e20dcbca84b
lock test: Fix performance problem on multi-core machines.

* gettext-runtime/tests/test-lock.c (USE_VOLATILE): New macro.
(struct atomic_int): New type.
(init_atomic_int, get_atomic_int_value, set_atomic_int_value): New
functions.
(lock_checker_done, rwlock_checker_done, reclock_checker_done): Define
as 'struct atomic_int'.
(lock_checker_thread, test_lock, rwlock_checker_thread, test_rwlock,
reclock_checker_thread, test_recursive_lock): Use the new functions.
Reported by Eric Blake in
https://www.redhat.com/archives/libvir-list/2012-March/msg00854.html
and by Pádraig Brady in
http://lists.gnu.org/archive/html/bug-gnulib/2016-12/msg00117.html.
gettext-runtime/tests/test-lock.c