Ejemplo n.º 1
0
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')
Ejemplo n.º 2
0
def main():
    q = thredo.Queue(maxsize=1)
    t1 = thredo.spawn(consumer, q)
    t2 = thredo.spawn(producer, q, 1000)
    t1.join()
    t2.join()
Ejemplo n.º 3
0
 def main():
     q = thredo.Queue()
     t = thredo.spawn(consumer, q)
     results.append('start')
     t.cancel()
Ejemplo n.º 4
0
 def main():
     q = thredo.Queue(maxsize=1)
     t = thredo.spawn(producer, q)
     results.append('start')
     thredo.sleep(0.1)
     t.cancel()
Ejemplo n.º 5
0
 def main():
     q = thredo.Queue()
     t1 = thredo.spawn(consumer, q)
     t2 = thredo.spawn(producer, q)
     t1.join()
     t2.join()