This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug nptl/21291] pthread cancellation fails when contending lock
- From: "dimitri.staessens at ugent dot be" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 09 Jun 2017 08:27:31 +0000
- Subject: [Bug nptl/21291] pthread cancellation fails when contending lock
- Auto-submitted: auto-generated
- References: <bug-21291-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=21291
--- Comment #9 from Dimitri Staessens <dimitri.staessens at ugent dot be> ---
I understand the arguments given, and the text can be interpreted the way
Torvald does, but they seem to me against the intent of the POSIX
specification.
POSIX states "A condition wait (whether timed or not) is a cancellation point."
It doesn't say that passing an expired timeout may lead to undefined behaviour.
To me, the clauses mentioned by Torvald have the intent to allow some leeway in
the implementation when a cancellation request arrives to a suspended thread or
a thread that timeouts, cancellation doesn't necessarily have to happen anymore
at that point and can be deferred. In other words, the implementation can
choose to check the cancellation at any time, else it'd have to check for
cancellation just before returning. But I don't think POSIX has in mind that
there is an execution path in the implementation that doesn't check the
cancellation state at all.
In the current implementation, pthread_cond_timedwait() effectively stops
behaving as a cancellation point if you pass it an expired timeout with the
monotonic clock. This may cause a lot of problems when that cond_timedwait() is
the only cancellation point in the thread, which is what the code example
revealed.
--
You are receiving this mail because:
You are on the CC list for the bug.