简体   繁体   中英

how to reset handlers registered by pthread_atfork

Some libraries might register some handlers with pthread_atfork() . I don't need them as I only use fork() together with 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 .

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM