join in threads

Tim Peters tim.one at comcast.net
Thu Jul 25 22:10:13 EDT 2002


[anton wilson]
> Is there a reason why join is only available for threads created with the
> threading library?

The only primitive thread operation Python can assume exists across a
gazillion incompatible platform thread implementations is the ability to
start a thread.

> Is there some architectural drawback why I couldn't just
> release the GIL, pthread_join, and then grab the GIL when I'm
> done?

pthread_join only exists on pthreads systems, and Python's thread API is
meant to be portable.

> I'm not sure what the threading module does but it doesn't seem to use
> the system's join functionality but somehow implements it on its own.

Yes; in general, it has no choice about that.  It can notice when a thread
it itself created has exited, but can't know anything about "foreign"
threads in a portable way.





More information about the Python-list mailing list