470,849 Members | 1,343 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

Threading program with issues when executing from IDLE

People, executing the following code from command line, it works as expected
(you see "th1 - 2" *always* after "th2 - 2").

But when I execute from IDLE one of two things happens:

- Everything freezes up after "th1 - 1".
- The program finishes but after I get an strange internal IDLE error.

There's a way to avoid that?

The code:

-----------------
import threading

def thfunc1():
print "th1 - 1"
event.wait()
print "th1 - 2"

def thfunc2():
print "th2 - 1"
print "th2 - 2"
event.set()

event = threading.Event()

th1 = threading.Thread(target=thfunc1)
th2 = threading.Thread(target=thfunc2)

th2.start()
th1.start()
-----------------

Thank you all!

.. Facundo

Jul 18 '05 #1
0 1175

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Thomas Philips | last post: by
13 posts views Thread by Varun | last post: by
2 posts views Thread by willie | last post: by
1 post views Thread by Your Friend | last post: by
21 posts views Thread by Illumineo | last post: by
8 posts views Thread by Luc | last post: by
3 posts views Thread by writser | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.