Threads in Python version 1.5, thread doesn't start until calling process dies
Ken Tabacchi
kentabacchi at excite.com
Wed Jul 25 10:01:20 EDT 2001
I am having some trouble with a threadded process in Python version
1.5. It seems that the thread does not start until the calling
process has died. The thread starts immediately when the following
program is run under Python version 2.1.
**********************************************
import thread, time
def Thread1():
while (1):
print "I`m in the thread"
time.sleep(1)
thread.start_new_thread(Thread1, ())
print "about to call time.sleep(4)"
time.sleep(4)
print "just slept for 4 seconds"
**********************************************
This is the Python version 1.5 execution of the above code:
about to call time.sleep(4)
just slept for 4 seconds
I`m in the thread
I`m in the thread
I`m in the thread
I`m in the thread
I`m in the thread
I`m in the thread
and here is the Python version 2.1 execution of the same code:
about to call time.sleep(4)
I`m in the thread
I`m in the thread
I`m in the thread
I`m in the thread
just slept for 4 seconds
I`m in the thread
I`m in the thread
I`m in the thread
I`m in the thread
I`m in the thread
I`m in the thread
Does any one have any suggestions?
Thanks in advance for your assistance.
Ken Tabacchi
More information about the Python-list
mailing list