[SSI] pthread application and SSI
Brought to you by:
brucewalker,
rogertsang
From: Aneesh K. K.V <ane...@di...> - 2003-01-08 15:44:22
|
Hi, I am getting lot of <defunct> process when I am running the below program on a SSI kernel where as on a non SSI kernel there is none. -aneesh #include <stdio.h> #include <unistd.h> #include <pthread.h> #include <signal.h> void * a ( void *p) { int i = (int )p; printf("Signal with value %d\n",i); printf("Hai\n"); for(i=0; i < 10; i++) { printf("Hai %d\n",i); } printf("thread exiting\n"); } void node ( int sig) { pthread_t tid; pthread_create(&tid,NULL,a,(void *)sig); } main() { sigset_t set; int sig = 2 ; while(1) { sigemptyset(&set); /* signal handlers are also registered for these * signals. That make sure none of the signals * are lost */ sigaddset(&set,SIGINT); sigwait(&set, &sig); if(sig == SIGINT) { node(sig); continue; }else if(sig == SIGCHLD ){ node(sig); continue; } else { printf("Received a signal on which i was not doing a sigwait \n"); exit(1); } } } |