Ctrl-C to stop C++ code in python

Jinsong Zhao zhaojs at yahoo.com
Wed Apr 30 19:30:26 EDT 2003


Some of my problems arise from extension in C++. Here is one of them. 

I have C++ codes that do a lot of computations in seconds to
minutes. The user may get bored and want to stop it by pressing
Ctrl-C, when it is running inside the C++ code. Unfortunately,
currently python does not detect that until the control is back to
python, which may be one minute later. This delay is very
frustrating.

I haven't found any solution in the Python Cookbook. Anyone to give a
hint as to how to achieve the "immediate kill" effect?

Jinsong




More information about the Python-list mailing list