Date: Mon, 30 Jun 2003 08:46:18 -0700 (PDT) From: xiong jinshan <xiongjinshan@yahoo.com> To: deischen@freebsd.org Cc: threads@freebsd.org Subject: Re: About the kse signal process Message-ID: <20030630154618.93274.qmail@web80511.mail.yahoo.com> In-Reply-To: <Pine.GSO.4.10.10306300936460.22873-100000@pcnet5.pcnet.com>
index | next in thread | previous in thread | raw e-mail
--- Daniel Eischen <eischen@vigrid.com> wrote:
> On Mon, 30 Jun 2003, xiong jinshan wrote:
>
> > Hi,
> > I am wondering that the following piece of code
> > can't work with the unix semantics. I tested it
> with
> > 5.1 release and i386 arch. By unix sementics, if I
> > send the SIGALRM to this running programme, it
> should
> > be received by the thr_func() only, and print a
> prompt
> > msg on the console.
>
> Yes, only thr_func() should receive the alarm.
This is the issue. Nothing printed on the console when
I sent the signal SIGALRM, it meant that none of the
thread received this signal.
>
> >
> > Reguards,
> > JinShan
> >
> > Ps: c code:
> >
> > /* vi: set ts=4 sw=4 expandtab: */
> > #include <stdio.h>
> > #include <signal.h>
> > #include <pthread.h>
> >
> > void sigalrm_handler(int signo)
> > {
> > if(signo != SIGALRM)
> > abort();
> >
> > printf("Received sig alarm!\n");
> > return;
> > }
> >
> > void thr_func(void)
> > {
> > sigset_t mask;
> > struct sigaction sa;
> >
> > sigemptyset(&mask);
> > sigaddset(&mask, SIGALRM);
> > pthread_sigmask(SIG_UNBLOCK, &mask, NULL);
> >
> > memset(&sa, 0, sizeof(struct sigaction));
> > sa.sa_handler = sigalrm_handler;
> > sigaction(SIGALRM, &sa, NULL);
> >
> > while(1);
> > }
> >
> > main()
> > {
> > int err;
> > pthread_t pth;
> > sigset_t mask;
> >
> > sigfillset(&mask);
> > sigprocmask(SIG_BLOCK, &mask, NULL);
> >
> > err = pthread_create(&pth, NULL, thr_func,
> NULL);
> > if(err < 0) {
> > perror("pthread_create!\n");
> > return -1;
> > }
> >
> > while(1);
>
> --
> Dan Eischen
>
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030630154618.93274.qmail>
