This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sigwait not returning


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]