summaryrefslogtreecommitdiff
path: root/Lib/test/mp_preload.py
blob: 5314e8f0b216323a9d138015cbd59daf5132ea7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import multiprocessing

multiprocessing.Lock()


def f():
    print("ok")


if __name__ == "__main__":
    ctx = multiprocessing.get_context("forkserver")
    modname = "test.mp_preload"
    # Make sure it's importable
    __import__(modname)
    ctx.set_forkserver_preload([modname])
    proc = ctx.Process(target=f)
    proc.start()
    proc.join()