• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import multiprocessing
2
3def foo(conn):
4    conn.send("123")
5
6# Because "if __name__ == '__main__'" is missing this will not work
7# correctly on Windows.  However, we should get a RuntimeError rather
8# than the Windows equivalent of a fork bomb.
9
10r, w = multiprocessing.Pipe(False)
11p = multiprocessing.Process(target=foo, args=(w,))
12p.start()
13w.close()
14print(r.recv())
15r.close()
16p.join()
17