def test_t(N=1000*1000): global nline from ms.debug_utils import killme; killme() nline = enumerate(itertools.count(1)) for i in xrange(1, N+1): t = threading.Thread(target=print_t, args=(i,)) t.start(); print t
import sys, time from ms.async_utils import \ TkControlPanel, TkinterTask, ThreadedTask, TwistedTask from ms.debug_utils import killme; killme() def print_(sym): for i in range(50): time.sleep(.1) sys.stdout.write(sym) sys.stdout.flush() yield i print "task %r ended" % sym def main_threaded(gen): t = ThreadedTask.generator(gen) for s in "+-*/": task = t(s) task.start() # print task raw_input("Press return to stop\n") ThreadedTask.stopAll() raw_input("\nPress return to resume") ThreadedTask.startAll() raw_input("Press return to exit\n") ThreadedTask.stopAll() def main_tkinter(gen): from Tkinter import Tk t = TkinterTask.generator(gen) root = Tk() for s in "+-*/":