public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] sigwait not returning
@ 2003-01-29 18:09 N.Suresh
  2003-01-29 23:33 ` Nick Garnett
  0 siblings, 1 reply; 6+ messages in thread
From: N.Suresh @ 2003-01-29 18:09 UTC (permalink / raw)
  To: ecos-discuss; +Cc: Shiv Kumar, Prakash R, Titty Thomas

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-01-31 18:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-29 18:09 [ECOS] sigwait not returning N.Suresh
2003-01-29 23:33 ` Nick Garnett
2003-01-30  8:44   ` N.Suresh
2003-01-30 17:46     ` N.Suresh
2003-01-31 14:29       ` Nick Garnett
2003-01-31 18:36         ` Nick Garnett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).