Threading madness

Lane LiaBraaten lliabraa at isrparc.org
Wed Nov 19 10:19:27 EST 2003


I am developing a GUI that uses multiple threading.Threads, and Queue.Queues 
for communicating between the threads, and threading.Timers for checking the 
queues.

Everything works well (runs to completion and exits) on my RedHat7.3 machine, 
but it doesn't work (hangs like some thread or queue is blocking)on RH9.  
However, when I ssh into the RH9 box from my RH7.3 box, the app runs fine (on 
my RH7.3 screen).

Now the madness sets in...if I compile the .py into a .pyc, and then run the 
.pyc the app works fine on both machines.

So any ideas on what could be going on here?

Also, what is a good way to implement a repeating timer? e.g.:

import threading
myTimer=threading.Timer(10,foo)
myTimer.start()

def foo():
	print "foo"
	myTimer.start() --> Assertion, thread already started

I am currently reseting the timer like this:

def bar():
	print bar
	myTimer=threading.Timer(10,bar)
	myTimer.start()

But isn't this a memory leak?  What happens to the old myTimer?

TIA,
LGL





More information about the Python-list mailing list