[英]how to reset handlers registered by pthread_atfork
Some libraries might register some handlers with pthread_atfork()
. 一些库可能会向pthread_atfork()
注册一些处理程序。 I don't need them as I only use fork()
together with exec()
. 我不需要它们,因为我只将fork()
与exec()
一起使用。 Also, they can cause trouble in some cases. 同样,它们可能在某些情况下引起麻烦。 So, is there a way to reset the registered handler list? 那么,有没有办法重置注册处理程序列表?
Related: calling fork()
without the atfork
handlers , fork()
async signal safety . 相关: 不使用atfork
处理程序调用fork()
, fork()
异步信号安全 。
POSIX does not document any mechanism for fork handlers installed by pthread_atfork()
to be removed, short of termination of the process or replacing the process image. POSIX没有记录任何删除由pthread_atfork()
安装的fork处理程序的机制,只是终止了进程或替换了进程映像。 If you don't want them, then don't install them. 如果您不想要它们,请不要安装它们。 If they are installed by a third-party library, as you describe, then your options are to find a way to avoid that behavior of the library (possibly by avoiding the library altogether) or to live with it. 如您所描述的,如果它们是由第三方库安装的,那么您的选择就是找到一种避免该库行为的方法(可能完全避免使用该库)或与其一起使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.