This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

pthreads, fork+exec, and deadlocks

I'm writing a threaded application which needs to be able to run other
programs for events/notifications, etc.

Having a thread that does a "fork() + exec()" leaves me with the
situation where the glibc internal mutexes/etc cloned can allready be
locked.  In particular, the one I'm concerned about is syslog_lock.

After fork(), I want to close all file descriptors, endpwent(),
closelog(), manage stdio/stderr/stdin etc. properly before doing the

Is there any way to lock/unlock/re-intialize the syslog_lock used in
openlog/closelog/vsyslog, or should I be explicitly guarding all syslog
usage with an additional application mutex for a safe fork?

Or are there better ways/models to handle exec'ing programs from large
threaded applications?

Thanks for any hints/pointers/links/etc.

Aidan Van Dyk                                             Create like a god,                                       command like a king,                                   work like a slave.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]