[250] in Pthreads mailing list archive
select exited on signal 6
daemon@ATHENA.MIT.EDU (Jin Guojun[ITG])
Fri Feb 2 13:43:44 1996
Date: Fri, 2 Feb 1996 10:03:21 -0800
From: "Jin Guojun[ITG]" <jin@george.lbl.gov>
To: pthreads@MIT.EDU
Does any one know why this happens? Please help.
% cc testing.c -lpthread
% .a.out
foobar:printing PID:20402
main:printing, PID:20401
main:printing, PID:20401
main:printing, PID:20401
^C
% tail /var/log/messages
Feb 2 09:32:16 hostname /kernel: pid 20402: a.out: uid 010: exited on signal 6
------------------------------- testing.c -----------------------------
void *foobar()
{
int cnt=3;
struct timeval to={5,0};
while(cnt-->0)
{
printf("foobar:printing PID:%d\n",getpid());
select(10,NULL,NULL,NULL,&to);
}
}
main()
{
int cnt=3;
struct timeval to={5,0};
if (fork()==0)
foobar();
while(cnt-->0)
{
printf("main:printing, PID:%d\n",getpid());
select(10,NULL,NULL,NULL,&to);
}
}
------------------------------- testing.c -----------------------------
compile:
cc testing.c -lpthread