Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个生成多个子进程的程序,如何让程序只在主进程上调用 atexit.register(function) 而不是在子进程上调用?
谢谢
通过 atexit 注册的函数由子进程继承。
防止这种情况发生的最简单方法是在生成子进程后调用 atexit。