How to pass / catch / respond to Python KeyboardInterrupt in C ++?

I have a simple library written in C ++ for which I am creating a Python shell to use boost.python. Some functions take a lot of time (more than 30 seconds), and I would like to make it intermittent, so when I press ctrl-d to run KeyboardInterrupt in the python interpreter, I can somehow respond to this in C ++.

Is there any way to do this? I could not find info on interrupts and boost.python on boost.org or python.org.

+6
c ++ python interrupt boost-python
source share
1 answer

Call PyErr_CheckSignals() so often.

+4
source share

All Articles