[Toc][Index]

DosSemClear


Bindings:  C, MASM 

This call unconditionally clears a semaphore.  If any threads were blocked 
on the semaphore, they are restarted. 
 DosSemClear    (SemHandle) 
 
 SemHandle (HSEM) - input 
    Reference to the semaphore. 
    For a system semaphore, this reference is the handle returned by a 
    DosCreateSem or DosOpenSem request that granted the requesting thread 
    access to the semaphore. 
    For a RAM semaphore, this reference is the address of a doubleword of 
    storage, allocated and initialized to zero by the application. This 
    sets the semaphore as unowned. Other than initializing the doubleword 
    to zero, an application must not modify a RAM semaphore directly; 
    instead it manipulates the semaphore with semaphore function calls. 
 rc (USHORT) - return 
    Return code descriptions are: 
    0         NO_ERROR 
    101       ERROR_EXCL_SEM_ALREADY_OWNED 
 
 Remarks 
 DosSemClear typically is used to release a semaphore obtained through 
 DosSemRequest. DosSemClear also is used with the semaphore signaling 
 functions DosSemSetWait, DosSemWait, and  DosMuxSemWait. 
 If the semaphore is an exclusive system semaphore, it has a use count 
 associated with it, which is incremented by a DosSemRequest and 
 decremented by a DosSemClear. The semaphore is not actually cleared and 
 made available to the next thread that wants to access the resource until 
 the semaphore has been cleared the same number of times it has been 
 requested. This means that exclusive system semaphores can be used in 
 recursive routines.  When the use count is 0, the semaphore is available 
 to be claimed by the next user of the protected resource. 
 Normally, DosSemClear cannot be issued against a system semaphore owned 
 by another process unless the NoExclusive option is set by the 
 DosCreateSem request that created the semaphore.  However, at interrupt 
 time any thread may clear an exclusively owned semaphore. 

Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs