| 1 |
import multiprocessing |
| 2 |
|
| 3 |
print(f"{__name__}") |
| 4 |
|
| 5 |
def f(): |
| 6 |
print("f") |
| 7 |
|
| 8 |
if __name__ == "__main__": |
| 9 |
ctx = multiprocessing.get_context("forkserver") |
| 10 |
ctx.set_forkserver_preload(['__main__']) |
| 11 |
for _ in range(2): |
| 12 |
p = ctx.Process(target=f) |
| 13 |
p.start() |
| 14 |
p.join() |