On Tue, May 28, 2002 at 05:47:56PM -0700, Hong Zhang wrote:
> > Important given: We can *not* use setjmp/longjmp. Period. Not an 
> > option--not safe with threads. At this point, having considered the 
> > alternatives, I wish it were otherwise but it's not. Too bad for us.
> 
> I think this statement is not very accurate. The real problem is
> setjmp/longjmp does not work well inside signal handler.

We cannot do much inside a signal handler anyway.  About the only safe
thing to do is to set a flag.  Then, parrot can check this flag
regularly at some safe points and run its own signal handler if the
flag is set.  Signal are asynchronous, so it is not a problem if they
are slightly delayed.

Another point is that we don't need setjmp/longjmp to raise an
exception from Parrot (byte)code.  It is more efficient to have our own
implementation.  And this implementation can do the right think with
respect to locks.

So, setjmp/longjmp is only interesting for raising an exception from C
code.  If the C code does not play with signals and locks too often,
then we can probably require that it setups an exception handler if it
needs to clean things up.

-- Jerome

Reply via email to