[Pythonmac-SIG] Multi-threaded extension ?

Jack Jansen jack@oratrix.nl
Fri, 25 Aug 2000 22:42:22 +0200


Recently, David Andersen <dma@andrew.cmu.edu> said:
> 
> I'm looking at writing a multi-threaded extension to Pythonmac, and my
> first question is "is this doable at all?"    Does Python call
> YieldToAnyThread?   Do I need to work with 1.6 as opposed to 1.5?

Python 1.6a2 has multithreading. It uses the GUSI pthreads
implementation, but as that is based on macos threads it does call
YieldToAnyThread at the right times. But, as it doesn't know about
your thread you may well starve your thread (although your extension
module could of course also call YieldToAnyThread). And, of course,
you're on your own if you need to do I/O in your thread. And you can't 
use Python in it.

And, of course, if you can live with pthreads then you can use that
and have your thread be a first class citizen.
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm