shawn bright wrote: > Hey there, > i have an app that runs several processes as threads. > using the threading.Thread() > > now, i have another app that does the same thing. Now, pretty soon, we > will be combining all the features of the two packages together into one > app. > > My question is, is there a limit on how many threads one GUI application > can have running in the background ? > Most of them are sleeping most of the time. They wake up and do > something every 10 seconds, 20 minutes, etc...
IIRC the number of threads is limited by memory - each thread requires some heap space for its stack, etc. I don't think you will have trouble until you have hundreds or thousands of threads. For example on my computer this program prints 1031 before it exits with thread.error: can't start new thread: import time from threading import Thread, activeCount def run(): while 1: time.sleep(1) while 1: print activeCount() t=Thread(target=run) t.setDaemon(1) t.start() (The setDaemon() call lets the application exit normally when it gets an exception; otherwise it hangs with all the threads running.) Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor