home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / programm / 4649 < prev    next >
Encoding:
Internet Message Format  |  1992-09-14  |  1.8 KB

  1. Path: sparky!uunet!spool.mu.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!sample.eng.ohio-state.edu!purdue!mentor.cc.purdue.edu!noose.ecn.purdue.edu!ecn.purdue.edu!kudva
  2. From: kudva@ecn.purdue.edu (Gautham K. Kudva)
  3. Newsgroups: comp.unix.programmer
  4. Subject: SIGALRM handlers and sleep
  5. Message-ID: <1992Sep14.203355.20114@noose.ecn.purdue.edu>
  6. Date: 14 Sep 92 20:33:55 GMT
  7. Sender: news@noose.ecn.purdue.edu (USENET news)
  8. Distribution: usa
  9. Organization: Purdue University Engineering Computer Network
  10. Lines: 23
  11.  
  12.  
  13. I'm trying to write a program that needs to interlace computations with
  14. communications. The platform is a Sun SPARC IPC running SunOS 4.1, though
  15. I'd like to keep the code as portable as possible. Previously I was using
  16. Sun's lwp package, but a bug in their code put paid to those plans. Now
  17. I'm trying to use signals. I'm installing a handler for SIGALRM and set
  18. alarms at uniform intervals. Compuatations go on as usual. Whenever the
  19. SIGALRM handler is called, it executes the communication code. Things 
  20. work out ok till I use a sleep() call. The call uses its own signal
  21. handler, and things get screwy. Rochkind does not mention anything about
  22. this. Richard Stevens' "UNIX Network Programming" says that sleep can 
  23. interact with a process' own SIGALRM handlers; but no details are given. 
  24. I haven't found anything on these lines in the man pages either. So is there 
  25. any way in which my signal handler can peacefully co-exist with sleep()?
  26. Or do I need to replace all sleep calls (using defines or something)
  27. with my custom sleep function which handles alarms right? I don't like
  28. the latter option, since I could be using pre-compiled code that contains
  29. calls to sleep. References to any book that addresses this issue would
  30. also be great. 
  31.  
  32. Thanks in advance,
  33. Gautham Kudva
  34. kudva@ecn.purdue.edu
  35.