KeyboardInterrupt vs extension written in C
Tamas Nepusz
ntamas at gmail.com
Thu Oct 20 09:27:55 EDT 2005
More information about the Python-list mailing list
Thu Oct 20 09:27:55 EDT 2005
- Previous message (by thread): KeyboardInterrupt vs extension written in C
- Next message (by thread): KeyboardInterrupt vs extension written in C
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi everyone, I have tried to do some googling before asking my question here, but I haven't found any suitable answer. I am developing a Python API for a graph library written in pure C. The library is doing an awful lot of math computations, and some of them can take a pretty long time (depending on the size of the input). If I invoke such calculation from Python using my own extension, the interpreter locks until the calculation is complete (I mean, it is not responding to Ctrl-C or SIGINT). My question is: is there any way to allow the user to use Ctrl-C to generate a KeyboardInterrupt and cancel such large computations? I'm assuming that although pressing Ctrl-C may generate a KeyboardInterrupt in Python, it is not propagated to the user level until the call into the graph library returns. I tried to add Py_BEGIN_ALLOW_THREADS before the call to the underlying C library and Py_END_ALLOW_THREADS after returning from it, but I had no luck. Thanks in advance for your answers, -- Tamas <ntamas at gmail.com>
- Previous message (by thread): KeyboardInterrupt vs extension written in C
- Next message (by thread): KeyboardInterrupt vs extension written in C
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list