Dear, There is a paragraph in the Base Specifications regarding Cancellation Points that seems to leave some room for interpretation, with rather dire consequences:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html It concerns the following paragraph: Whenever a thread has cancelability enabled and a cancellation request has been made with that thread as the target, and the thread then calls any function that is a cancellation point (such as /pthread_testcancel/() <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_testcancel.html> or /read/() <http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>), the cancellation request shall be acted upon before the function returns. If a thread has cancelability enabled and a cancellation request is made with the thread as a target while the thread is suspended at a cancellation point, the thread shall be awakened and the cancellation request shall be acted upon. It is unspecified whether the cancellation request is acted upon or whether the cancellation request remains pending and the thread resumes normal execution if: * The thread is suspended at a cancellation point and the event for which it is waiting occurs * A specified timeout expired before the cancellation request is acted upon. In the newest glibc implementation (2.25), the clause "It is unspecified whether the cancellation request is acted upon if ... a specified timeout expired" is taken against the first statement of the paragraph. The new implementation of pthread_cond_timedwait() does not act upon a pending cancellation request if the abstime (specified using the monotonic clock) has already expired. See the bug report and discussion here: https://sourceware.org/bugzilla/show_bug.cgi?id=21291 From the way this paragraph is written, I think the interpretation by the developer is, however unpalatable, a valid one. However my interpretation is that the first statement (that a cancellation request that is pending before any cancellation point is entered, must always be acted upon, irrespective of any input to the cancellation point) is non-negitiable and the clauses are only valid when there was no pending cancellation request at the time of entry into the cancellation point. This would be a much more robust interpretation. Can you please clarify how this should be interpreted? thank you very much for your assistance, Dimitri Staessens Ghent University-imec