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? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---