The ECL documentation contains some information about how to set up signal handling with embedded ECL, but from what I understand the options are
1. Disable signals while ECL code is running 2. Let ECL install its signal handlers (which, in multithreaded mode, means that ECL will run a thread that will eat and process all signals) The specific situation I am looking into is integrating ECL into sage, so basically python. Option 2 seems not feasible, because Python wants to be able to handle its own signals. Plus, I expect that ECL can't possibly handle signals properly when execution is not within ECL (we will only be calling into ECL routines occasionally). Option 1 seems undesirable, because the intended program to run, maxima, can sometimes take very long and it would be nice if the user can still interrupt the computation with CTRL-C when maxima is running. Currently, we have the option 3. Enable the standard signal handler that is unaware of ECLs requirements and just longjmps out of ECL when a signal occurs. This *seems* to work quite well, but I cannot believe this is actually safe to do. In fact, if someone knows of LISP operations that react particularly badly to being interrupted so rudely, I would be interested in testing the present code with it to see how badly things go wrong. I imagine the *proper* solution is option 4. Make Sage's signal handler aware of ECL's requirements and have a flag that records whether ECL code is currently executing. If so, handle the signal in a way that works well with ECL. Perhaps there is a flag that can be set "a signal has occurred", on which ECL would simply act as soon as it is safe and raise the appropriate Condition. This would then propagate to the appropriate condition handler and (provided no other handlers are installed) come out at the point where ECL was called, where we can raise the appropriate Python exception in response. So my question is: Where do I start in the ECL API to find the right hook to connect to in the signal handler? For background: Currently we are just running ECL in a single thread, since Maxima was not really designed for multi-threaded use anyway. Additionally, if someone thinks other options than the ones above are more appropriate I would be interested in hearing about them as well. Kind regards, Nils Bruin ------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev _______________________________________________ Ecls-list mailing list Ecls-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ecls-list