def bench_parent(backend=None, strat='string'): # Launch a child process proc1 = ExecProcess(func=bench_client, backend=backend, strat=strat) proc2 = ExecProcess(func=bench_client, backend=backend, strat=strat) proc1.dump(STOP) proc2.dump(STOP) from process_tom.queue import JobQueueIn queue = JobQueueIn([proc2, proc1], backend, strat) print("Parent start") queue.put('hello') for i in range(10): queue.put('world') queue.put(STOP) queue.put(STOP) proc1.close() proc2.close() from time import sleep sleep(3) print('Parent finished')
def bench_parent(backend=None, strat='string'): # Launch a child process proc1 = ExecProcess(func=bench_client, backend=backend) proc2 = ExecProcess(func=bench_client, backend=backend) proc1.dump(STOP) proc2.dump(STOP) cout, cin = Pipe() proc1.dump(cout) proc2.dump(cout) print("Parent start") cout.send('hello') for i in range(10): cout.send('world') cout.send(STOP) cout.send(STOP) proc1.close() proc2.close()