linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bubulac Tatiana <bubulac@unidec.ro>
To: linux-c-programming@vger.kernel.org, redhat-list@redhat.com
Subject: Signal and wait question
Date: Tue, 21 May 2002 18:20:39 +0300	[thread overview]
Message-ID: <3CEA65C6.D0473BEB@unidec.ro> (raw)

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.


                 reply	other threads:[~2002-05-21 15:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3CEA65C6.D0473BEB@unidec.ro \
    --to=bubulac@unidec.ro \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=redhat-list@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).