def testReadWriteLocks(locksfile_path): print("Running testReadWriteLocks...") #Using manager only for barrier... pool = Pool(2) m = Manager() b = m.Barrier(2) funcs = [partial(testRangesProc1, b, locksfile_path), partial(testRangesProc2, b, locksfile_path)] pool.map(smap, funcs) pool.close() pool.join()
def run(): global manager, shared_dict server_args = parse_args() manager = Manager() shared_dict = manager.dict() shared_bar = manager.Barrier(parties=get_num_processes(configuration)) topics_procs, _ = process_data_config(configuration, server_args, shared_bar) atexit.register(cleanup, config=configuration, topics_procs=topics_procs) print("Producer script started") shared_bar.wait() if server_args.stop and server_args.stop.isdigit(): time.sleep(int(server_args.stop)) else: input("Press Enter to exit...")