home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / question / 10710 < prev    next >
Encoding:
Text File  |  1992-09-03  |  1.0 KB  |  42 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!csn!evolving.com!dxs
  3. From: dxs@evolving.com (Dan Stanger)
  4. Subject: signal handling
  5. Message-ID: <1992Sep3.231414.66861@evolving.com>
  6. Date: Thu, 3 Sep 1992 23:14:14 GMT
  7. Organization: Evolving Systems, Inc.
  8. Lines: 32
  9.  
  10. i want to write a program with the following structure
  11.  
  12. linked_list
  13.  
  14. handler()
  15. {
  16.    put structure on linked list indicating signal
  17. }
  18.  
  19. main()
  20. {
  21.    loop
  22.       disable signals
  23.       check linked list to see if a signal occured
  24.       enable signals
  25.       /* location 1 */
  26.       wait on message queue until message is sent
  27.       disable signals
  28.       check linked list to see if a signal occured
  29.       enable signals
  30.       process either message or signal
  31.    end loop
  32. }
  33.  
  34. since the wait on the message queue will be terminated if a signal
  35. occurs the signal will be handled quickly.  however if the signal
  36. occurs while the program is at location 1 then the signal will not
  37. be handled until a message comes in.
  38.  
  39. is there a way around this?
  40. thanks
  41. dan stanger
  42.