def main(): # thredo.spawn(spin, 60_000_000) q = thredo.Queue() with thredo.ThreadGroup(wait=None) as g: g.spawn(spin,100_000_000) for n in range(4): g.spawn(worker, q, f'Worker-{n}') for n in range(10): q.put(n) thredo.sleep(1) q.join() print('Done')
def main(): q = thredo.Queue(maxsize=1) t1 = thredo.spawn(consumer, q) t2 = thredo.spawn(producer, q, 1000) t1.join() t2.join()
def main(): q = thredo.Queue() t = thredo.spawn(consumer, q) results.append('start') t.cancel()
def main(): q = thredo.Queue(maxsize=1) t = thredo.spawn(producer, q) results.append('start') thredo.sleep(0.1) t.cancel()
def main(): q = thredo.Queue() t1 = thredo.spawn(consumer, q) t2 = thredo.spawn(producer, q) t1.join() t2.join()