On Fri, 28 Sep 2001, Benjamin Stuhl wrote: > Thus did the Illustrious Dan Sugalski <[EMAIL PROTECTED]> > write: > > Croak's going to throw an interpreter exception. There's > > a little bit of > > documentation about the exception handling opcodes in > > docs/parrot_assembly.pod, with more to come soonish. > > This is fine at the target language level (e.g. perl6, python, jako, > whatever), but how do we throw catchable exceptions up through six or > eight levels of C code? AFAICS, this is more of why perl5 uses the > JMP_BUF stuff - so that XS and functions like sv_setsv() can > Perl_croak() without caring about who's above them in the call stack. > The alternative is that _every_ function simply return a status, which > is fundamentally expensive (your real retval has to be an out > parameter, to start with).
This is my point exactly. To answer my own question (at least, with regards to Solaris), the attributes(5) man page says that 'Unsafe' is defined thus: > An Unsafe library contains global and static data that is not > protected. It is not safe to use unless the application arranges for > only one thread at time to execute within the library. Unsafe > libraries may contain routines that are Safe; however, most of the > library's routines are unsafe to call. This would imply that in the worst case (at least for Solaris) we could just wrap calls to [sig]setjmp and [sig]longjmp in a mutex. 'croak' happens relatively infrequently anyway. In this case, the only problem is that we then can't 'croak' from a signal handler; nor can we even use sigset/longjmp from a signal handler at all becuase another thread could be using them at the same time. - D <[EMAIL PROTECTED]>