It would be a nice feature to have, but in 8+ years working with Boost.Python I 
never truly needed it.

I figure if your extension runs a long time it must have some layers of loops. 
If you can modify the
extension code, I'd reorganize it to move the outer loop into Python. If the 
extension is a function,
I'd turn it into a class like this:

  calc = calculation()
  while (calc.is_not_finished()):
    calc.inner_loop()

If you figure out how to make Ctrl-C work portably (!), post it here!

Ralf


----- Original Message ----
From: Amos Anderson <nitroa...@gmail.com>
To: Development of Python/C++ integration <cplusplus-sig@python.org>
Sent: Wed, February 3, 2010 12:24:13 PM
Subject: [C++-sig] how do i interrupt a C++ extension?

Hello --

I've got a python script with C++ extensions. Some of my extensions
take a long time to complete, and I don't want to wait for them to
finish when I'm debugging stuff. However, when I do Ctrl-C in my
terminal, it's completely ignored. So it looks like python is trapping
the signal, but apparently can't do anything with it until the
extension returns control to the python script. I guess ideally,
Ctrl-C would kill the extension and return control to python,
generating an exception, but I'd also be ok if Ctrl-C killed the
python script too.

I've been googling around, but can't figure out how this seemingly
simple (and desired) task is accomplished. Anybody know how to do it?
Right now, the only solution is Ctrl-Z and kill %1 so I guess that
works for now...

thanks!

Amos.
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to