Email List: Xaustin-review-lX
[All Lists]

Defect in XSH pthread_cleanup_pop()

To: yyyyyyyyyyyyyyy@xxxxxxxxxxxxx
Subject: Defect in XSH pthread_cleanup_pop()
From: yyyyyyy@xxxxxxxxxx
Date: Fri, 21 Feb 2003 08:28:28 GMT
        Defect report from : Ulrich Drepper , Red Hat

(Please direct followup comments direct to yyyyyyyyyyyyyy@xxxxxxxxxxxxx)

@ page 1020 line 32065 section pthread_cleanup_pop() objection {ud-cleanup1}

Problem:

Defect code :  1. Error

The intend of the definition of the cleanup interfaces is to provide exception 
handling which can also be implemented using macros in plain C.  The cleanup 
code is expected to run only when an exception occurs, which in case of 
pthreads is a call to pthread_exit() or the cancellation of the thread.

Specifically a normal return does not constitute an exception.  And very 
specifically, a return from the function started with pthread_create() 
costitutes an implicit call to pthread_exit() but the return itself does *not* 
represent such a call.

But it is questionable whether any premature exit from a cancellation block is 
valid in the first case.  Dave Butenhof wrote:

>>>>
Since we can't [...] require exceptions, the standard must prohibit 'return', 
'break', 'continue', and 'goto' [...]
<<<<<

This is clearly a requirement unless exceptions are mandatory which is not 
acceptable (at this point in time at list).

Action:

Add additional limitations.  Add a new paragraph starting at line 32065:

The effect of the use of 'return', 'break', 'continue', and 'goto' to 
prematurely leave a block described by a pair of pthread_cleanup_push() / 
pthread_cleanup_pop() functions calls in undefined.

<Prev in Thread] Current Thread [Next in Thread>
  • Defect in XSH pthread_cleanup_pop(), drepper <=