[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problems getting signal to work
- Date: Tue, 3 Sep 2002 17:55:44 -0400
- From: cwelch at neumes.com (Chris Welch)
- Subject: Problems getting signal to work
I'm having problems to get signals working properly with RTEMS 4.5.1.
With the program example at the end of this email, SIGALRM is does get set
(sigismember begins to return 1) after a three second delay, but the
handler, catchsig, is never called.
This program works correctly under Linux and Cygwin.
Any suggestions would be appreciated.
Perhaps there is a configuration definition I'm missing?
Thanks in advance,
Chris
----------------
#include <stdio.h>
#include <signal.h>
void catchsig();
int main()
{
char c = '.';
sigset_t NewSet;
struct sigaction NewSigAction;
struct sigaction OldSigAction;
// Set up the new signal action
NewSigAction.sa_handler = catchsig;
sigemptyset(&NewSet);
NewSigAction.sa_mask = NewSet;
NewSigAction.sa_flags = 0;
sigaction(SIGALRM, &NewSigAction, &OldSigAction);
alarm(3);
write(1, &c, 1);
while(1)
{
//pause();
sleep(1);
sigpending(&NewSet);
printf("%lx\n", sigismember(&NewSet, SIGALRM));
}
exit (0);
}
void catchsig()
{
char c = '.';
write(1, &c, 1);
alarm(1);
}
----
Chris Welch, Neumes Consulting, PC and UNIX Solutions
mailto:cwelch at neumes.com
613)797-7831 FAX:(613)838-5602
http://www.neumes.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Chris Welch.vcf
Type: text/x-vcard
Size: 369 bytes
Desc: not available
Url : http://rtems.rtems.org/pipermail/rtems-users/attachments/20020903/0e0ed383/attachment.vcf