On Thu, Dec 14, 2023 at 10:51 AM 'Mark Maker' via libuv <[email protected]> wrote: > > Hi, > > I've read up on the PR and others related to fork(). I've seen > > int uv_loop_fork(uv_loop_t *loop) > > is marked experimental. Furthermore, if I understand fork(2) correctly, then > a multi-threaded program is never save to fork() without exec. > > > After a fork() in a multithreaded program, the child can safely call only > > async-signal-safe functions (see signal-safety(7)) until such time as it > > calls execve(2). > > Is there some guidance as to what functionality is save to use prior to fork > with libuv? > > Which parts of libuv use threads and which parts are guaranteed not to? > > Use case: > > Prior to fork() I need socket/accept and/or pipe operations, and then want to > setup SIGCHLD handlers, i.e. the parent will fork() many times and keep tabs > on children, and re-fork() them when they die. In the child I need to get rid > of the parent's listener socket and signal handlers, and only keep the socket > and/or the right ends of pipes. > > _Mark
Libuv makes no guarantees whatsoever. That's also why uv_loop_fork() will always stay experimental. It's use-at-your-own-risk. -- You received this message because you are subscribed to the Google Groups "libuv" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/libuv/CAHQurc9dS%2BZSeagKFJrFt_LTD2QHrqqppM5WOxS8E9hrvOdwKw%40mail.gmail.com.
