Dan Sugalski <dan@sidhe.org> writes: >At 12:11 PM 1/21/01 +0000, Alan Burlison wrote: >>Note that even if we used C++ it wouldn't help us in this case, because >>although C++ does exceptions, it knows nothing about threads, mutexes or >>CVs. I suspect the perl6 interpreter loop will look something like: >> >> while (! end of script) { >> if (at cancellation point) { >> if (signal detected) >> call script signal handler; >> if (something died) >> rollback stack; >> } else { >> do next OP; >> } >> } > >I'm waffling between checking between every op, or having an op that >explicitly checks. (Possibly the end-of-statement cleanup op would do this) FWIW - current perl5.7.* development sources so the signal stuff every op. i.e. we should have "safe signals" now. (Which makes the sigsetjmp vs setjmp even less interesting as C level handler does neither.) > >>In other words the C level signal handler will have to do no more than >>setting a flag, as will the implementation of die(). You need to explain the die case some more. Consider: if (sv == NULL) { Perl_die("Something is not valid"); } iv = SvIV(sv); With the perl5 scheme the die longjmp()s away from the segfault. So the implementation of "die" has to do more than set a flag. It has to "noop" the code untill we reach a cancellation point. It also has to save the "context" (file, line) and/or the "message". It will end up looking like Tcl core... i.e. just about everything returns not the value you wanted, but a flag to say whether it died or not - I guess the flag could be in the "interpreter" data structure, but you are still going to have to test it. >>By cancellation >>point I mean somewhere that is defined as 'safe', i.e. not holding any >>mutexes or waiting on any CVs etc. So what do we do if we die with a lock held? -- Nick Ing-SimmonsThread Previous | Thread Next