Embedding Python in a multi-threaded C++ application

Jeff Epler jepler at unpythonic.net
Tue Nov 9 15:21:23 EST 2004


Perhaps you can use PyErr_SetInterrupt() to create a KeyboardInterrupt
in the Python thread.

    void PyErr_SetInterrupt(    )
        This function simulates the effect of a SIGINT signal arriving
        -- the next time PyErr_CheckSignals() is called,
        KeyboardInterrupt will be raised. It may be called without
        holding the interpreter lock. 

There's no way to "clean up" after Python if you terminate its
thread---Python's datastructures could be in an inconsistent state, so
just releasing a lock wouldn't do you any good.

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20041109/27a6a234/attachment.sig>


More information about the Python-list mailing list