call Python from a multithreaded DLL

Mark Hammond MarkH at ActiveState.com
Fri Jul 6 03:25:03 CEST 2001


Alexandre Perrin wrote:

There are a few problems here.  One is that the code as it standard will 
almost certainly finalize Python before your thread has acquired the lock.

If you look at the Python for Win32 extensions source code 
(starship.python.net/crew/mhammond/cvs.html) and find the 'pywintypes.h' 
file, you will find a 'CEnterLeavePython' class.  This manages the 
thread state for you and allows 'random' threads to call back into Python.

Mark.




More information about the Python-list mailing list