psxcancel test failure

Sebastian Huber sebastian.huber at embedded-brains.de
Sat Mar 9 11:14:53 UTC 2013


Hello Joel,

I briefly look at the cancellation sequence but it seemed to be quite 
complex.  There is also a POSIX requirement that we don't meet at the 
moment:

http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_cancel.html

"The cancellation processing in the target thread runs asynchronously 
with respect to the calling thread returning from /pthread_cancel()/. "

There is also a problem in pthread_cleanup_push().  It allocates memory 
from the workspace and fails silently in case this is not possible.  
POSIX allows this:

http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_cleanup_pop.html

"These functions may be implemented as macros and will appear as 
statements and in pairs within the same lexical scope (that is, the 
/pthread_cleanup_push()/ macro may be thought to expand to a token list 
whose first token is *`{'* with /pthread_cleanup_pop()/ expanding to a 
token list whose last token is the corresponding *`}'*. "

So it is possible to place the control structure on the thread stack.

On 08/03/13 20:23, Joel Sherrill wrote:
> Hi
>
> Sebastian mentioned this failure to me privately and I have taken a first
> look at it.
>
> My impression is that the cancellation request is doing some thread exit
> work and then the thread calls pthread_exit() and does it again. The
> second time, it faults dereferencing a NULL pointer.
>
> I will think on it but a fix is likely not too hard. I just want to 
> understand
> the flow before I insert a NULL pointer check.
>


-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the devel mailing list