Richard Oudkerk | e88a244 | 2012-08-14 11:41:32 +0100 | [diff] [blame] | 1 | import multiprocessing, sys |
2 | |||||
3 | def foo(): | ||||
4 | print("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 | |||||
10 | p = multiprocessing.Process(target=foo) | ||||
11 | p.start() | ||||
12 | p.join() | ||||
13 | sys.exit(p.exitcode) |