3 ms·
Would it be possible to do something a bit more modern-feeling such as register a callback address that gets executed on fork?
by IgorPartola 12y ago
Would it be possible to do something a bit more modern-feeling such as register a callback address that gets executed on fork?
- TheLoneWolfling 12y agoJust don't fork in that callback... Or call anything that potentially forks.
- JoshTriplett 12y agoIf you can count on pthreads, you can use pthread_atfork for that.
- taejo 12y agoThe problem with that is that a library can't count on pthreads: the application might call clone directly, without going through the libc wrapper, which calls the atfork callbacks.
- JoshTriplett 12y agoVery good point; pthread_atfork does not suffice. Thanks for the correction.