threaded embedded python calls
Stuart D. Gathman
stuart at bmsi.com
Sat Aug 24 13:05:38 EDT 2002
On Fri, 23 Aug 2002 18:02:35 -0400, Thomas Grill wrote:
> i'm really stressing my nerves with this one: I have some threaded c
> code which loads a python module and calls functions therein. The calls
> can occur in several different threads.
> I've read every line i could find on this topic (especially "8.1 Thread
> State and...." - hard to believe that THIS could make it into the
> official documentation...) - yet, nothing but deadlocks and crashes.
> Could someone point me to some real functioning code how this is
> managed? That would be extremely cool.
Here is another example:
The miltermodule.c code should help. This application starts in python,
but transfers control to a multithreaded C library (libmilter) which then
invokes python callbacks from many C threads. An important key is
PyAcquireThreadState (sp?) since the same interpreter thread state may be
called by different C threads.
Stuart D. Gathman <stuart at bmsi.com>
Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flamis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.
More information about the Python-list