[Python-Dev] Extension modules, Threading, and the GIL
holger krekel
pyth@devel.trillke.net
Thu, 9 Jan 2003 13:00:08 +0100
Tim Peters wrote:
> [...]
> I'd also like to postulate that proposed solutions can rely on a new Python
> C API supplying a portable spelling of thread-local storage. We can
> implement that easily on pthreads and Windows boxes, it seems to me to cut
> to the heart of several problems, and I'm willing to say that Python
> threading doesn't work anymore on other boxes until platform wizards
> volunteer code to implement this API there too.
FWIW, I am pretty confident that this can be done (read: copied) as
Douglas Schmidt has implemented it (on more platforms than python
supports <wink>) in the Adapative Communication Framework (ACE):
http://doc.ece.uci.edu/Doxygen/Beta/html/ace/classACE__TSS.html
As usual, Douglas Schmidt also presents a detailed platform
analysis and research about his implementation:
http://www.cs.wustl.edu/~schmidt/PDF/TSS-pattern.pdf
"This paper describes the Thread-Specific Storage pattern, which
alleviates several problems with multi-threading performance and
programming complexity. The Thread-Specific Storage pattern improves
performance and simplifies multithreaded applications by allowing
multiple threads to use one logically global access point to retrieve
thread-specific data without incurring locking overhead for each
access."
regards,
holger