These may not be related issues. C++ exceptions do not require the explicit use
of "volatile", while setjmp()/longjmp() do. As a result, it is almost
impossible to implement C++ exceptions using setjmp()/longjmp(). This was an
unfortunate choice on the part of the standards authors, but we have to live
with it.
/glen
-----Original Message-----
From: Schwarz Konrad [mailto:yyyyyyyyyyyyyy@xxxxxxxxxxx]
Sent: May 21, 2004 10:01 AM
To: 'Alexander Terekhov'; Dave Butenhof
Cc: yyyyyyyyyyyyyy@xxxxxxxxxxxxx
Subject: RE: XSH/XRAT conflict over cancellation points
After pondering the issue some more, I fail to see what impact
setjmp()/longjmp() actually have on thread cancellation.
The cancellation stack is simply a list of routines that must be invoked at
certain times. Although it might be interesting from a maximum stack-usage
point of view to unwind the stack to the frame that has registered a
cancellation handler before invoking that cancellation handler, this is an
(probably not terribly important) optimization which need not be implemented
via setjmp()/longjmp(). I see no other reason for using setjmp()/longjmp()
in cancellation handlers. Issues might exist for C++, but that is
out-of-scope for POSIX.
On the other hand, if the issues for C++ (exceptions) require
setjmp()/longjmp() handling on platforms without additional exception unwind
info even for C routines, then I think it would be in order for POSIX to
require the argument passed to the cleanup routine to be qualified as
volatile.
On the third hand, it is probably the case for C++ exception handling that
the longjmp() back into exception catching routine needs to be done only for
routines that actually catch exceptions, which are C++ anyway, and C++
apparently is able to avoid the need for volatile qualification.
Regards,
Konrad Schwarz
This message may contain privileged and/or confidential information. If
you have received this e-mail in error or are not the intended recipient, you
may not use, copy, disseminate or distribute it; do not open any attachments,
delete it immediately from your system and notify the sender promptly by e-mail
that you have done so. Thank you.
|