Article View: comp.os.os2.programmer
Article #1721Re: Can semaphore be released/cleared from other process ?
From: Peter Forsberg
Date: Thu, 05 Nov 1992 07:48
Date: Thu, 05 Nov 1992 07:48
39 lines
2153 bytes
2153 bytes
In <1992Nov4.195019.27417@cs.tu-berlin.de> Ernst Kloecker writes:
>Hi,
>
>in a multi-tasking application I am implementing at the moment I want to
>use semaphores to protect critical regions. What happens if a process hangs
>or dies during execution of the critical region ? Can I release/clear this
>semaphore from another process (watchdog) to avoid a deadlock ? Does
>OS/2 provide any mechanism for this situation ?
>
>This question applies to both OS/2 1.3 and OS/2 2.0, because I cannot
>move to OS/2 2.0 right now.
>
>Thanks for any info, Ernst.
>
>--
>
>-----------------------------------------------------------------------------
>Ernst Kloecker phone: ++49-30-6181635 e-mail: ernst@cs.tu-berlin.de
>-----------------------------------------------------------------------------
>
From the 1.3 CP reference:
If a process terminates while owning a nonexclusive system semaphore,
ERROR_SEM_OWNER_DIED is returned to the thread that next gets the
semaphore through DosSemRequest. That thread takes steps to ensure
the integrity of the resource. The thread can release the resource
by issuing a DosSemClear, or it can reset the ERROR_SEM_OWNER_DIED
return code condition flagged in the semaphore data structure.
The same goes for 2.0 (but the calls are named differently).
Now, if the owning program hangs (in a tight loop for example) there isn't
much you can do.
Peter
--
Peter Forsberg E-mail: peterf@vnet.ibm.com (primary)
d88-pfo@nada.kth.se (alternate)
Disclaimer: This posting represents the poster's views, not those of IBM
Technical Details
Message-ID:
<19921104.224920.547@almaden.ibm.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!vnet.ibm.comReferences:
<1992Nov4.195019.27417@cs.tu-berlin.de>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!vnet.ibm.com From: peterf@vnet.ibm.com (Peter Forsberg) Message-ID: <19921104.224920.547@almaden.ibm.com> Date: Thu, 5 Nov 92 07:48:30 SWE Newsgroups: comp.os.os2.programmer Subject: Re: Can semaphore be released/cleared from other process ? Reply-To: peterf@vnet.ibm.com Organization: IBM Corporation Disclaimer: This posting represents the poster's views, not those of IBM News-Software: UReply 3.0 References: <1992Nov4.195019.27417@cs.tu-berlin.de> Lines: 39