int main() {
signal(SIGCHLD,sigchld_handler);
for(;;) {
/* do some heavy weight stuff */
/* check for child_terminated and perform waitpid */
}
Maybe the debug-call is the reason. It is sending the String to the local syslog-daemon, using sockets and therefore a bunch of system calls. When I consider strace, I see the arrival of SIGCHLD and the futex call directly behind it.
When the futex call is performed, the 3rd argument is a "2". I verified it using PTRACE_PEEKDATA on the 1st argument (which is the address of the futex value). It really is a "2". Do you know what this "2" exactly means? Does it mean one process blocked a ressource and another one is now suspended? What happens if I write a "1" to the futex address?
Basically my program looks like this:
static volatile sig_atomic_t child_terminated=0;
void sigchld_handler(int sig) { terminated= 1; SIGCHLD, sigchld_ handler) ; copy_errno;
int copy_errno=errno;
debug("Received SIGCHLD");
child_
signal(
errno=
}
int main() { SIGCHLD, sigchld_ handler) ;
signal(
for(;;) {
/* do some heavy weight stuff */
/* check for child_terminated and perform waitpid */
}
Maybe the debug-call is the reason. It is sending the String to the local syslog-daemon, using sockets and therefore a bunch of system calls. When I consider strace, I see the arrival of SIGCHLD and the futex call directly behind it.
When the futex call is performed, the 3rd argument is a "2". I verified it using PTRACE_PEEKDATA on the 1st argument (which is the address of the futex value). It really is a "2". Do you know what this "2" exactly means? Does it mean one process blocked a ressource and another one is now suspended? What happens if I write a "1" to the futex address?
Thanks a lot for answers ;-)