So basically I'm writing a threaded python program, which uses 10 threads, stored in a variable called threads. There loop that starts the threads looks like this:
for x in xrange(threads):
print "STARTING THREAD " + str(x)
t = threading.Thread(target=worker)
t.setDaemon(True)
t.start()
The program executes normally, except for the fact that after it prints STARTING THREAD 9, it just exits without executing the worker function. The worker function looks like this.
def worker():
try:
while True:
try:
ss = my_class()
ss.start()
time.sleep(0.009)
except:
pass
except:
pass
The class has threading.Thread.__init__(self)
in it's init method, and is declared like class my_class(threading.Thread)
I can't seem to figure out what's wrong, and nobody else seemed to have had this problem.