simple thread problem

Markus Gritsch gritsch at iue.tuwien.ac.at
Mon Jun 19 10:35:08 EDT 2000


Hi!

I started a very simple program to get familiar with Python threads.
It works fine, except for some misterious messages which I get every
time a thread exits:

currentThread(): no current thread for xxxx

where 'xxxx' is some small integer number.  I also tried to terminate
the thread with thread.exit() (which should treminate the thread
silently), but the message remains.

How can this message be avoided?

Kind regards,
Markus

--------------------------------------------------

#! /usr/bin/env python

import thread, threading
import time

sem = threading.Semaphore(3)

def getit(argum):
    try:
        print 'good night from', argum
        time.sleep(1)
        print 'hello again form', argum
    finally:
        sem.release()

for number in range(6):
    sem.acquire()
    print 'starting', number
    thread.start_new_thread(getit, (number, ))

time.sleep(2)





More information about the Python-list mailing list