Defect Report concerning: IEEE Std. 1003.1c-1995, ISO/IEC 9945-1:1990 AMD 2 - Threads
Clause: 18.1.4
PASC Interpretation Ref: pasc-1003.1c-33
Topic: Thread Cancellation, Async-Cancel Safety


This is an unapproved interpretation of PASC 1003.1c-1995, ISO/IEC 9945-1:1990 AMD 2 - Threads.

Use of the information contained in this unapproved document is at your own risk.

Last update: 30 March,1998


								1003.1c-95  #33

 _____________________________________________________________________________

Interpretation Number:	33
Topic:               Thread Cancellation, Async-Cancel Safety
Relevant Sections:   18.1.4

Interpretation Request: (Defect Report)
-----------------------

	Date: Tue, 27 Aug 1996 15:27:10 -0400
	From: Dave Butenhof <butenhof@zko.dec.com>
        Standard: 9945-1:1996 (1003.1, 1996 Edition)


7. Section 18.1.4, Thread Cancellation, Async-Cancel Safety

   pthread_cancel is specified to be async-cancel safe, along with the
   pthread_setcancelstate and pthread_setcanceltype functions. I see
   no reasonable justification for allowing cancellation while async
   cancellation is enabled, nor does the rationale attempt to give any
   justification. I believe that pthread_cancel should be removed from
   the list of async-cancel safe functions. Async cancellation is an
   unusual "aberration", and I see no reason to allow use of any POSIX
   standard functions with async cancellation type except the
   functions required to disable cancellation.

        REF:    page 349, section 18.1.4, line 112



Interpretation for IEEE Std 1003.1c-1995:
-------------------------------------------

The standard is clear that pthread_cancel shall be async-cancel safe, and
conforming implementations must conform to this.  

Rationale
-------------
Requiring pthread_cancel() to be async-cancel safe potentially makes
it easier for helper threads running with asynchronous cancellation
enabled to themselves cancel other threads.  This imposes no undue
burden on implementations since, if necessary, the pthread_cancel()
implementation can always internally set the cancellation state to
defer cancellation while pthread_cancel() is being executed and then
restore the cancellation state after the cancel request has been
executed.   

Forwarded to Interpretations group: August 29 1996
Proposed resolution: 18 Sep 96
Finalised: 27 Jan 97