Message402818
I still have some questions about is, so re-open it.
You mean it is the fork principle, but if change the script to use os.fork(), the child process will inherit from parent, and also free it.
You could refer below change:
from ctypes import cdll
import multiprocessing as mp
import os
def foo():
handle = cdll.LoadLibrary("./test.so")
handle.IncA()
if __name__ == '__main__':
foo()
#p = mp.Process(target = foo, args = ())
#p.start()
#print(p.pid)
#p.join()
pid = os.fork()
if pid == 0:
foo()
else:
os.waitpid(pid, 0) |
|
Date |
User |
Action |
Args |
2021-09-29 02:56:18 | eleven.xiang | set | recipients:
+ eleven.xiang, vstinner |
2021-09-29 02:56:18 | eleven.xiang | set | messageid: <1632884178.9.0.985009138374.issue45308@roundup.psfhosted.org> |
2021-09-29 02:56:18 | eleven.xiang | link | issue45308 messages |
2021-09-29 02:56:18 | eleven.xiang | create | |
|