linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Signal and wait question
@ 2002-05-21 15:20 Bubulac Tatiana
  0 siblings, 0 replies; only message in thread
From: Bubulac Tatiana @ 2002-05-21 15:20 UTC (permalink / raw)
  To: linux-c-programming, redhat-list

Hi ,

I have a parent that catch the SIGTERM and SIGALRM signals.
...
 signal (SIGTERM, die);
 signal (SIGALRM, dummy);
...
for (min = 0; min < 15 && not_done; min++)
    {
      alarm ((unsigned int) 60); /* wait for 1 minute */
      pid = wait (&status);    /* Wait for a process to end */
      alarm ((unsigned int) 0); /* Reset alarm */
....
}

and a child that use the same signal catch function.
...
signal (SIGTERM, die);
...


Here is the die fucntion.
#include......
void die();

void die ()
{
  signal (SIGTERM, (void (*)())die);
  printf("child receives SIGTERM signal\n");
  return;
}

void s_down();

void s_down ()
{
  extern BOOLEAN l_down;

  signal (SIGALRM, (void (*)())s_down);
  l_down = TRUE;
  printf("child receive SIGALRM signal\n");
  return;
}

When I send a sigterm signal only the parent display
"parent receives SIGTERM signal" and stack here.
If I give a kill -9 child pid the parent displays "Normal
Termination"and than Killed.

Why the parent stack in wait() and child do not receive any signal?

TIA.

Bubulac Tatiana.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-05-21 15:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-21 15:20 Signal and wait question Bubulac Tatiana

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 NNTP newsgroup(s).