This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
sigwait not returning
- From: "N.Suresh" <nsuresh at cdotb dot ernet dot in>
- To: ecos-discuss <ecos-discuss at sources dot redhat dot com>
- Cc: 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: Wed, 29 Jan 2003 22:43:50 +0530
- Subject: [ECOS] sigwait not returning
- Organization: C-DoT
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?
thanx in advance,
regards
<cut>
#include <signal.h>
#include <pthread.h>
#include <stdio.h>
#include <errno.h>
#include <cyg/infra/diag.h>
main ()
{
int ret_val;
sigset_t set;
int sig;
// Unblock all the signals
sigfillset (&set);
pthread_sigmask (SIG_UNBLOCK, &set, (sigset_t*)NULL);
//--------------------------------------------------------------------
// <start of timer initialization section>
//--------------------------------------------------------------------
struct itimerspec timerValue; // Timeout value on eCos
timer_t timer1; // Timer
struct sigevent sev;
// Notification type --- Deliver the signal
sev.sigev_notify = SIGEV_SIGNAL;
sev.sigev_signo = SIGALRM;
sev.sigev_value.sival_int = 0xABCDEF01;
// Timer values --- 1 Second
timerValue.it_value.tv_sec = 1;
timerValue.it_value.tv_nsec = 0;
timerValue.it_interval.tv_sec = 0;
timerValue.it_interval.tv_nsec = 0;
if (timer_create (CLOCK_REALTIME, &sev, &timer1) != 0)
diag_printf ("Error in creating the timer\n");
if (timer_settime (timer1, 0, &timerValue, NULL ) !=0)
diag_printf ("Error in setting the time\n");
//--------------------------------------------------------------------
// <end of timer initialization section>
//--------------------------------------------------------------------
diag_printf ("Timer initialisation is completed..\n");
// Wait for any signal to arrive
sigfillset (&set);
ret_val = sigwait (&set, &sig);
if (ret_val ==0)
{
diag_printf ("The signal number %d received\n", sig);
}
else
diag_printf ("Error in sigwait call\n");
diag_printf ("Program terminating\n");
exit (0);
}
</cut>
--
!============================================================================!
= Suresh N., Research Engineer, C-DoT, Bangalore. =
= Call me at : OFF: 2383951(Dir) / 2263399 (268) RES: 3334248 =
= Alternate email : nsur_mys@rediffmail.com =
= QOT: Modern man is the missing link between apes and human beings.
!============================================================================!
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss