On Sun, Aug 23, 2009 at 1:54 PM, Nils Bruin<nbr...@sfu.ca> wrote:
>
>
> On Aug 23, 3:43 am, Juanjo <juanjose.garciarip...@googlemail.com>
> wrote:
>> > Concerning signals:
>> ECL does not need to be notified of signals. The important thing is
>> that Sage's code does not interrupt ECL's code at arbitrary places and
>> then transfers control out of them.
>>
>> For instance, interrupts during memory allocation are bad. Also when
>> initializing certain objects. If the interrupt handler jumps out of
>> that code in an arbitrary way, the program may be left in a corrupt
>> state.
>>
>> If your signal handler does not jump to outer points, but rather does
>> normal returns, then there is no problem with installing that handler.
>> Otherwise,  as I said, we can instruct ECL's handler to delay signals
>> after the critical code has finished and then pass them to whatever
>> handler was installed before.
>>
>> Use of sigaction inside ECL is definitely _not_ an option. It is a
>> very expensive call to put in front of every memory allocation
>> routine.
>>
>> As a side note, no sensible signal handler would do any other thing
>> than returning, for POSIX interrupts do not guarantee reentrancy of
>> code. However, I do not know what is the quality of Sage's interrupt
>> handling right now.
>
> That is good to know. I noticed that in cython code, there are options
> for turning signals on and off. We could just turn signals off any
> time we enter ecl and back on when we return. The obvious drawback
> would be that
> this means the CTRL-C will not work within ECL code. If ECL were to
> get signals, I guess it could just raise an error if CTRL-C happens.
> But then ECL would indeed need to have its signal handler in place
> (and hence call the previous signal handler too, to give sage a shot).
>
> Anybody with good knowledge of sage signal handling with some input?

I agree with what you write above.  It would be very good for
control-c to work, since not having that really sucks for users.  I
hate it when control-c doesn't work right.

<rant> E.g., I hate this about Magma:

flat:code wstein$ magma
Magma V2.15-11    Sun Aug 23 2009 14:00:21 on flat     [Seed = 804571302]
Type ? for help.  Type <Ctrl>-D to quit.
> n := Factorization(10^997-1);
^C^C  <-- I hit control-c a few times
^C^C  <-- I hit it a few more times
[Interrupt twice in half a second; exiting]
Total time: 10.330 seconds, Total memory usage: 8.38MB
flat:code wstein$
</rant>

Sage is better at that.

Anyway, I'm confident these signal issues with ECL can be sorted out.
Some people around here who might have some useful comments are
Gonzalo Tornaria and Martin Albrecht.

William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to