home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / programm / 4362 < prev    next >
Encoding:
Internet Message Format  |  1992-08-18  |  1.3 KB

  1. Path: sparky!uunet!usc!nic.csu.net!koko.csustan.edu!rat!zeus!kwang
  2. Newsgroups: comp.unix.programmer
  3. Subject: SIGNALS
  4. Message-ID: <1992Aug19.001455.222056@zeus.calpoly.edu>
  5. From: kwang@zeus.calpoly.edu (Kevin Wang aka The Scarecrow)
  6. Date: Wed, 19 Aug 1992 00:14:55 GMT
  7. Organization: The Outland Riders
  8. Lines: 25
  9.  
  10. How does one handle multiple signals that happen (almost)
  11. simultaneously?  Currently, the parent process forks off multiple
  12. times, and each of the children then dies after it's done.  Now, if all
  13. 3-5 children finish almost immediately, the signal handler doesn't
  14. finish before the next signal comes in.  At the very minimum, I need to
  15. wait() for the child process so that I can get its exit value.
  16. Currently the handler looks like:
  17.  
  18. void ChildHandler(void)
  19. {
  20.     Handle_the_signal();
  21.     signal(SIGCHLD, SIG_IGN);  /* the only way I know to 'clear' the signal */
  22.     signal(SIGCHLD, ChildHandler);
  23.     return;
  24. }
  25.  
  26. help?  inside Handle_the_signal() it has a bit of searching to do, so it's
  27. taking longer than I'd like it to, but I can't find any other way around it.
  28.  
  29.    - Kevin Wang
  30. ...And now, for your local station identification, on the hour, every hour...
  31. kwang@hermes.calpoly.edu or kwang@gauss.elee.calpoly.edu
  32. ---
  33.                           MURPHY'S LAWS OF COMBAT
  34.    4. There is always a way.
  35.