Problems with threads and embedding

Jeff Epler jepler at
Tue Jan 6 17:00:36 CET 2004

On my system, the attached script shows an expected behavior: at first
there are many threads running "", then they slowly dwindle
back down to one.  Using slightly different flags to ps (it doesn't know
the "m" flag), I get identical results on redhat 6 (python 1.5.2) and
redhat 9 (python 2.2).

import thread, Queue, os
l = []
q = Queue.Queue(10)

def enqueue():
    os.system("ps mT")

for i in range(10):
    thread.start_new(enqueue, ())

for i in range(10):
    print q.get()

os.system("ps mT")

This suggests that the problem may be architecture-specific,
thread-library specific, or it may be due to some difference between
the normal python executable and the executable with embedded Python.


More information about the Python-list mailing list