At 8:24 PM +0200 5/29/02, Jerome Vouillon wrote:
>On Wed, May 29, 2002 at 11:45:45AM -0500, David M. Lloyd wrote:
>> Dan may have been referring to the fact that on some key platforms
>> (Solaris included) (sig)setjmp/longjmp are officially marked as unsafe for
>> use inside of threads.
>
>Is it really unsafe on these platforms?
>- According to the Unix 98 specification, (sig)setjmp/longjmp must be
> thread-safe. Recent versions of Solaris are supposed to conform to
> this standard.
>- The Solaris Multithreaded Programming Guide says:
> " Note that you can use sigsetjmp(3C) and siglongjmp(3C) in
> multithreaded programs, but be careful that a thread never does a
> siglongjmp() using the results of another thread's sigsetjmp(). "
> (http://www.cs.columbia.edu/~hgs/teaching/isp/threads.pdf)
I've checked with some Sun folks. My understanding is that if you
don't do a list of what I'd consider obviously stupid things like:
*) longjmp out of the middle of an interrupt handler
*) longjmp across a system call boundary (user->system->user and the
inner jumps to the outer)
*) Expect POSIX's dead-stupid mutexes to magically unlock
*) Share jump destinations amongst threads
*) Use the original Solaris thread implementation in general
then you should be safe.
Maybe I've spent too much time working on systems where the interrupt
rate was high enough that you were likely to be in system code when
an interrupt occurred, but those all (well, except the last) seem to
fall into the "Well, *duh*, chuckehead" category.
I think we'll be safe using longjmp as a C-level exception handler.
I'm right now trying to figure whether it's a good thing to do or
not. (I'd like to unify C and Parrot level exceptions if I can)
--
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk