eleven xiang <eleven.xi...@gmail.com> added the comment:

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)

----------
status: closed -> open

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45308>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to