views:

34

answers:

1

I have a simple library written in C++ which I'm creating a Python wrapper for using boost.python. Some functions take a long time to execute (over 30 seconds), and I would like to make it interruptible so that when I hit ctrl-d to trigger KeyboardInterrupt in the python interpreter, I'm somehow able to respond to that in C++.

Is there a way to do this? I couldn't find any information about interrupts and boost.python at boost.org or python.org.

+2  A: 

Call PyErr_CheckSignals() every so often.

Ignacio Vazquez-Abrams