home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / question / 10252 < prev    next >
Encoding:
Text File  |  1992-08-20  |  1.2 KB  |  35 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!mcsun!Germany.EU.net!murignis!ap542!D012S436!frank
  3. From: frank@D012S436.sniap.mchp.sni.de ()
  4. Subject: Re: Alarm() and children
  5. Message-ID: <1992Aug21.101444.1149@sniap.mchp.sni.de>
  6. Sender: news@sniap.mchp.sni.de (News Admin)
  7. Organization: Siemens-Nixdorf AG
  8. References: <1992Aug14.055543.26826@nuscc.nus.sg>
  9. Date: Fri, 21 Aug 92 10:14:44 GMT
  10. Lines: 23
  11.  
  12. ccechk@nuscc.nus.sg (Heng Kek) writes:
  13. : If I have a program which spawns 20 children almost simultaneously
  14. : (i.e. via a loop) and arrange for a SIGALRM to be delivered after
  15. : 'x' seconds in each of the children,  will the signal in one child
  16. : affect other children?
  17. : The alarm() is called in each of the children.
  18.  
  19. No, each process has an independent alarm.  I think you also need
  20. to set up the signal handler *after* the fork.  
  21.  
  22. Btw, Watch out for the library call 'sleep', it uses alarm().
  23. It will cancel any outstanding alarm  - I spent several hours
  24. looking for that one the first time I came across it!
  25.  
  26.  
  27. Hope this helps,
  28. --
  29. Frank O'Dwyer                           Disclaimer: 
  30. Siemens-Nixdorf AG                             I will deny everything
  31. Tel.  : +49 (89) 636-40639                      Fax.  : +49 (89) 636-45860
  32. e-mail: Frank.ODwyer@sniap.mchp.sni.de
  33.