Status of thread module?

Daniel W. Connolly (connolly@hal.com)
Fri, 18 Mar 1994 10:40:31 -0600

I'm interested in writing a multi-threaded TCP/IP server in python.
How solid is the thread support in python? I have done a fairly
thorough search of the code, documentation, FAQ, and stuff available
through the Web. My impression is that thread support is still pretty
immature.

How much does thread support slow down the interpreter?
What about reentrancy in libc.a on the SunOS platform?

About blocking system calls... are these only addressed at the
level of python functions or at the C bindings? For example, what
if a builtin extension module calls read() -- will it block all the
threads?

I have experience with an implementation of <pthread.h> style threads
in C. But what I'd like to see is the Modula 3 Thread interface.

I can't work out in my head it it's possible to implement condition
variables in terms of the python thread module, but I suspect it is.

I don't suppose there's an easy way to simulate the Modula-3 LOCK
statement. I guess I can just write:

m = Thread.Mutex()
m.acquire(); try:
<stuff>
finally: m.release()

a lot.

What about Thread.join() and Thread.alert()? Can
pthread_cond_timedwait() be implemented in terms of Modula-3's
Thread.Wait() and Thread.alert()?

Dan

p.s. What I really want is a Modula-3 development environment...

But I'm having fun with python. I'm a big perl fan, but it's difficult
to program with confidence in perl because it's too forgiving -- there
are all sorts of unchecked runtime errors. And the namespace is a
little funky. But you can't beat it for processing flat-files... it's
nice to have an interpreter that optimizes regular expressions into
boyer-moore searches, for example.