home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / programm / 4659 < prev    next >
Encoding:
Text File  |  1992-09-15  |  1.5 KB  |  34 lines

  1. Newsgroups: comp.unix.programmer
  2. Path: sparky!uunet!mcsun!Germany.EU.net!Urmel.Informatik.RWTH-Aachen.DE!physik.tu-muenchen.de!berg
  3. From: berg@physik.tu-muenchen.de (Stephen R. van den Berg)
  4. Subject: Re: SIGALRM handlers and sleep
  5. Message-ID: <1992Sep15.135222.2911@Urmel.Informatik.RWTH-Aachen.DE>
  6. Originator: berg@tabaqui
  7. Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner)
  8. Nntp-Posting-Host: tabaqui
  9. Organization: Rechnerbetrieb Informatik  /  RWTH Aachen
  10. References: <1992Sep14.203355.20114@noose.ecn.purdue.edu>
  11. Date: Tue, 15 Sep 92 13:52:22 GMT
  12. Lines: 20
  13.  
  14. Gautham K. Kudva writes:
  15.  
  16. >this. Richard Stevens' "UNIX Network Programming" says that sleep can 
  17. >interact with a process' own SIGALRM handlers; but no details are given. 
  18. >I haven't found anything on these lines in the man pages either. So is there 
  19. >any way in which my signal handler can peacefully co-exist with sleep()?
  20. >Or do I need to replace all sleep calls (using defines or something)
  21. >with my custom sleep function which handles alarms right?
  22.  
  23. I'm afraid using a custom sleep() is the only portable solution.  At least that
  24. was the conclusion I reached after inspecting the sleep() and SIGALRM
  25. implementations on several machines.
  26.  
  27. It basically boils down to recomputing the alarm() time after every sleep()
  28. has finished and to compensate for the slept seconds.
  29. -- 
  30. Sincerely,                                  berg@pool.informatik.rwth-aachen.de
  31.            Stephen R. van den Berg (AKA BuGless).    berg@physik.tu-muenchen.de
  32.  
  33. "I have a *cunning* plan!"
  34.