This is the mail archive of the
mailing list for the libc-ports project.
PI mutex support for pthread_cond_* now in nptl
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: libc-ports at sourceware dot org
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 18 Feb 2013 16:26:37 +0530
- Subject: PI mutex support for pthread_cond_* now in nptl
The x86 assembly code for pthread_cond_* functions has, since some
time now, been capable of utilizing PI mutexes (using
PTHREAD_PRIO_INHERIT when initializing a mutex) optimally by using the
FUTEX_WAIT_REQUEUE_PI and its companion FUTEX_CMP_REQUEUE_PI to
requeue waiters woken on pthread_cond_broadcast to the PI mutex while
waking just one child, hence avoiding the thundering herd effect.
This code is now available on the default C implementation in master,
which is used by most non-x86 architectures in glibc.
To allow your architecture to use this, you need to define the
- lll_futex_wait_requeue_pi macro to call the FUTEX_WAIT_REQUEUE_PI
operation in a futex syscall.
- lll_futex_timed_wait_requeue_pi, which is the timed equivalent of
- lll_futex_cmp_requeue_pi to call FUTEX_CMP_REQUEUE_PI.
I have committed implementations for s390 and powerpc, which can be
used as examples for implementation on other architectures.