[C++-sig] KeyboardInterrupt with boost?!

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Tue Jun 27 18:31:50 CEST 2006

--- Naceur Meskini <Naceur.Meskini at sophia.inria.fr> wrote:

> I have one question about how boost-python deal with Keyboard interrupting
> I have exposed a collection of functions and I would like to be able to 
> interupt the execution of some of them in the python side.

I am not aware of an elegant way to handle this situation. If you find out
please let us know. It is not a Boost.Python specific problem btw. All C/C++
extensions have the same problem.

My solution is a very simple one: Almost all of our (very many) C++ functions
typically return after a few seconds at the most, most in fractions of a
second. Then Python gets a chance to handle the KeybordInterrupt. You don't
have to do anything special. I.e. simply leave that outermost loop in Python if
you can.

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the Cplusplus-sig mailing list