473,405 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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 1239

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Thomas Philips | last post by:
I'd like to stop a program (i.e. terminate its execution) without raising an exception if some condition is met, e.g answer = " " while answer not in "yn": answer = raw_input("y for yes, n for...
13
by: Varun | last post by:
Hi Friends, Department of Information Technology, Madras Institute of Technology, Anna University, India is conducting a technical symposium, Samhita. As a part of samhita, an Online Programming...
2
by: willie | last post by:
Hi, I'm writing a program which requires the use of three serial ports and one parallel port. My application has a scanning devices on each port, which I can access fine with pyserial. ...
1
by: Your Friend | last post by:
Hello All, I'm having issues capturing the output from a program while using threading. Program runs ok when I run without threading. Here's my Python code and the Java class that is called by...
77
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for...
13
by: RCS | last post by:
I have a UI that needs a couple of threads to do some significant processing on a couple of different forms - and while it's at it, update the UI (set textboxes, fill in listviews). I created a...
21
by: Illumineo | last post by:
My application uses multiple-threads and is a kind of AI simulation or ALife. This works fine but I was wondering if and how one can make use of hyper-threading in C#? Thanks for any hint,...
8
by: Luc | last post by:
Hi, I am writing software to automate some testing. I have one main form to set up the tests, and once this is complete, I open 4 identical forms to monitor each different device that I am...
3
by: writser | last post by:
hey all, For my study I'm writing a simple threaded webcrawler and I am trying to do this in python. But somehow, using threads causes IDLE to crash on Windows XP (with the latest python...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.