This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: sigwait not returning
- From: Nick Garnett <nickg at ecoscentric dot com>
- To: "N.Suresh" <nsuresh at cdotb dot ernet dot in>
- Cc: ecos-discuss <ecos-discuss at sources dot redhat dot com>,Shiv Kumar <bshiva at cdotb dot ernet dot in>,Prakash R <rprakash at cdotb dot ernet dot in>,Titty Thomas <titty at cdotb dot ernet dot in>
- Date: 29 Jan 2003 18:47:28 +0000
- Subject: Re: [ECOS] sigwait not returning
- References: <3E380BCE.9010201@cdotb.ernet.in>
"N.Suresh" <nsuresh@cdotb.ernet.in> writes:
> Hi all,
> I am using sigwait () call to handle the signal in a thread.
> But the call never returns.
>
> We have traced the call and found that the thread is exiting in
> cyg_deliver_signals function with
> error "Unknown handler for the signal".
>
> I think it shouldn't enter the function at all, because the
> delivery method for
> sigwait call is via the broadcast method for the global condition
> variable named signal_sigwait.
> I have attached the example code below.
> Am i missing something?
You are. For sigwait() to work you have to block the signals you are
sigwait()ing for from normal delivery. sigwait() then unblocks the
signals it wants, but stops them from being delivered via the normal
mechanism and delivers them by returning.
> // Unblock all the signals
> sigfillset (&set);
> pthread_sigmask (SIG_UNBLOCK, &set, (sigset_t*)NULL);
Try this instead:
pthread_sigmask (SIG_BLOCK, &set, (sigset_t*)NULL);
--
Nick Garnett - eCos Kernel Architect
http://www.eCosCentric.com/
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss