Signal handler and longjmp question

Yi Wang <[email protected]>
Newsgroups org.kernel.vger.linux-c-programming
Message-ID <[email protected]>
Hi, all
    I read from some book that a signal handler can either return or call exit, abort or longjmp, it is permitted by ANSI C.
    However, I remember that lonjmp never returns, which in turn causes the signal handler can not return. In that case, the kernel will think the program is in signal handler forever, am I right? 
    IMHO, I think that is too bad...

Leo

--------------------------------------
code sample:

jmp_buf buf;
static void signal_handler(int signo)
{
    longjmp(buf);
}
int main()
{
  signal(SIGUSR1, signal_handler);
  ...
  setjmp(buf);
  ...
  return 0;
}

Suppose the program received SIGUSR1 after setjmp has been called, is the program still in signal handle context after longjmp?


_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.