Embedded python with threads

Greg Chapman glc at well.com
Fri Sep 17 09:40:35 EDT 2004


On Fri, 17 Sep 2004 01:05:13 +0200, nik <my.news.groups at noos.fr> wrote:

>I think I was making an assumption that since the list filling threads 
>didn't run that the import module was calling the create thread command, 
>then exiting (killing the children threads along with it) - I'm a novice 
>at threads with python, so I'm probably misunderstanding the general 
>picture. However, maybe your suggestion of the Py_BEGIN_ALLOW_THREADS 
>will make the difference. I'll try again as soon as I can (not until 
>next week now)...

OK, this sounds like you were definitely not releasing the GIL (the Global
Interpreter Lock).  To get an idea of how Python's threading works (from the C
side of things), I'd suggest reading this:

http://www.python.org/dev/doc/devel/api/threads.html

That's from the documentation for 2.4, but I believe everything there applies to
2.3 as well.  I'm linking to it because it includes some discussion of the
PyGILState functions (this discussion is missing from the 2.3 docs, but the
functions are there).

---
Greg Chapman




More information about the Python-list mailing list