Problems getting signal to work
Chris Welch
cwelch at neumes.com
Tue Sep 3 21:55:44 UTC 2002
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://lists.rtems.org/pipermail/users/attachments/20020903/0e0ed383/attachment.vcf>
More information about the users
mailing list