This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Add and use new glibc-internal futex API in sparc code.
- From: Torvald Riegel <triegel at redhat dot com>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: David Miller <davem at davemloft dot net>, GLIBC Devel <libc-alpha at sourceware dot org>
- Date: Tue, 09 Jun 2015 23:11:45 +0200
- Subject: Re: [PATCH] Add and use new glibc-internal futex API in sparc code.
- Authentication-results: sourceware.org; auth=none
- References: <1433800497 dot 21461 dot 455 dot camel at triegel dot csb> <20150609205152 dot A37C02C3BDC at topped-with-meat dot com>
On Tue, 2015-06-09 at 13:51 -0700, Roland McGrath wrote:
> Arguably every use of ignore_value should have a comment explaining why
> it's safe to elide the error checking.
That's always the same pattern. Would it be okay for you if I just note
that pattern in the futex_wait comments? Like so:
A common usage of futex_wait is to wait until a futex_word does not have
an expected value anymore:
while (atomic_load_relaxed (&futex_word) == expected)
ignore_value (futex_wait (&futex_word, expected, private));
In such a case, we continue waiting even if we were interrupted by a
signal (i.e., when futex_wait returned EINTR). We could have also woken
up spuriously when 0 is returned by futex_wait, so it is easiest to just
check the value of the futex word to determine whether we need to keep
waiting.