home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / os / os2 / programm / 6212 < prev    next >
Encoding:
Internet Message Format  |  1992-11-04  |  2.1 KB

  1. Path: sparky!uunet!vnet.ibm.com
  2. From: peterf@vnet.ibm.com (Peter Forsberg)
  3. Message-ID: <19921104.224920.547@almaden.ibm.com>
  4. Date: Thu, 5 Nov 92 07:48:30 SWE
  5. Newsgroups: comp.os.os2.programmer
  6. Subject: Re: Can semaphore be released/cleared from other process ?
  7. Reply-To: peterf@vnet.ibm.com
  8. Organization: IBM Corporation
  9. Disclaimer: This posting represents the poster's views, not those of IBM
  10. News-Software: UReply 3.0
  11. References: <1992Nov4.195019.27417@cs.tu-berlin.de>
  12. Lines: 39
  13.  
  14. In <1992Nov4.195019.27417@cs.tu-berlin.de> Ernst Kloecker writes:
  15. >Hi,
  16. >
  17. >in a multi-tasking application I am implementing at the moment I want to
  18. >use semaphores to protect critical regions. What happens if a process hangs
  19. >or dies during execution of the critical region ? Can I release/clear this
  20. >semaphore from another process (watchdog) to avoid a deadlock ? Does
  21. >OS/2 provide any mechanism for this situation ?
  22. >
  23. >This question applies to both OS/2 1.3 and OS/2 2.0, because I cannot
  24. >move to OS/2 2.0 right now.
  25. >
  26. >Thanks for any info, Ernst.
  27. >
  28. >--
  29. >
  30. >-----------------------------------------------------------------------------
  31. >Ernst Kloecker      phone: ++49-30-6181635      e-mail: ernst@cs.tu-berlin.de
  32. >-----------------------------------------------------------------------------
  33. >
  34.  
  35. From the 1.3 CP reference:
  36.  
  37.  If a process terminates while owning a nonexclusive system semaphore,
  38.  ERROR_SEM_OWNER_DIED is returned to the thread that next gets the
  39.  semaphore through DosSemRequest. That thread takes steps to ensure
  40.  the integrity of the resource.  The thread can release the resource
  41.  by issuing a DosSemClear, or it can reset the ERROR_SEM_OWNER_DIED
  42.  return code condition flagged in the semaphore data structure.
  43.  
  44. The same goes for 2.0 (but the calls are named differently).
  45. Now, if the owning program hangs (in a tight loop for example) there isn't
  46. much you can do.
  47.  
  48. Peter
  49. --
  50. Peter Forsberg           E-mail:  peterf@vnet.ibm.com          (primary)
  51.                                   d88-pfo@nada.kth.se        (alternate)
  52. Disclaimer: This posting represents the poster's views, not those of IBM
  53.