import thread, sys
def main():
print "Main Thread:", thread.get_ident()
count = 0;
try:
while 1:
thread.start_new_thread(test,(`count`,))
count = count + 1;
except:
print "Total Threads:", count
print "Exiting Main Thread:", thread.get_ident()
raise
def test(input=None):
print "count:", thread.get_ident(), input
while 1: #keep thread alive until it breaks
pass
if __name__ == "__main__":
main()