deadlock in signal handler with NPTL
Thorsten Kukuk
kukuk@suse.de
Tue Jun 22 21:51:00 GMT 2004
Hi,
I got the following test program. I know, it is very ugly and there
are a lot of things somebody should not do, but this is something
what programs like sshd are doing.
The problem is: This program deadlocks very fast in a FUTEX_WAIT
call. This does not happen with LinuxThreads.
Any ideas what goes wrong?
Thorsten
--
Thorsten Kukuk http://www.suse.de/~kukuk/ kukuk@suse.de
SuSE Linux AG Maxfeldstr. 5 D-90409 Nuernberg
--------------------------------------------------------------------
Key fingerprint = A368 676B 5E1B 3E46 CFCE 2D97 F8FD 4E23 56C6 FB4B
-------------- next part --------------
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <syslog.h>
#include <signal.h>
void
handler(int sig)
{
syslog(LOG_DEBUG, "sigtest");
printf("in handler\n");
fflush(stdout);
}
int
main(int argc, char *argv[])
{
pid_t pid;
switch (pid = fork()) {
case 0:
break;
case -1:
perror("form");
exit(1);
default:
signaller(pid);
exit(0);
}
signal(SIGCHLD, handler);
while (1) {
syslog(LOG_DEBUG, "test");
printf("in loop\n");
fflush(stdout);
}
}
int
signaller(pid_t pid)
{
while (1) {
usleep(1);
kill(pid, SIGCHLD);
}
}
More information about the Libc-hacker
mailing list