Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C Moderated > Re: signal catc...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 10 Topic 1078 of 1134
Post > Topic >>

Re: signal catching not work

by Thomas Richter <thor@[EMAIL PROTECTED] > Apr 18, 2008 at 04:11 PM

Terry schrieb:
> The code is supposed to catch two segment fault, but the second is
> always missing on my machine. Could anyone tell me why this code
> doesn't work as expected?

> void sighandler(int a){
>     static int i=0;
>     longjmp(buf, ++i);
> }

The manual of signal also states:

       Upon arrival of a signal with number signum the following happens. 
 If  the  corresponding  handler  is  set  to
       SIG_IGN,  then  the signal is ignored.  If the handler is set to
SIG_DFL, then the default action associated with
       the signal (see signal(7)) occurs.  Finally, if the handler is set
to a function sighandler then first either the
       handler  is  reset to SIG_DFL or an implementation-dependent
blocking of the signal is performed and next sighan-
       dler is called with argument signum.

Check, especially, the last sentence. It states that you have to
re-install your signal handler to ensure that it will be used again.


Greetings,
	Thomas
-- 
comp.lang.c.moderated - moderation address: clcm@[EMAIL PROTECTED]
 -- you must
have an appropriate newsgroups line in your header for your mail to be
seen,
or the newsgroup name in square brackets in the subject line.  Sorry.
 




 10 Posts in Topic:
signal catching not work
Terry <cong818@[EMAIL   2008-04-16 16:56:15 
Re: signal catching not work
jgd@[EMAIL PROTECTED] (J  2008-04-18 16:10:59 
Re: signal catching not work
Keith Thompson <kst-u@  2008-04-21 13:18:42 
Re: signal catching not work
Jack Klein <jackklein@  2008-04-18 16:11:11 
Re: signal catching not work
=?ISO-8859-1?Q?Hans-Bernh  2008-04-18 16:11:13 
Re: signal catching not work
Kenneth Brody <kenbrod  2008-04-18 16:11:30 
Re: signal catching not working
Markus Elfring <Markus  2008-04-18 16:11:26 
Re: signal catching not work
Thomas Richter <thor@[  2008-04-18 16:11:23 
Re: signal catching not work
Terry <cong818@[EMAIL   2008-04-21 13:19:41 
Re: signal catching not work
Terry <cong818@[EMAIL   2008-05-05 16:01:17 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 3:35:28 CDT 2008.