win12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
WinMsgSemWait (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WINMESSAGEMGR
 
USHORT WinMsgSemWait(hsem, lTimeOut);
HSEM hsem;        /* handle of the semaphore */
LONG lTimeOut;    /* time-out value          */
 
The WinMsgSemWait function waits for a specified semaphore to be cleared.
WinMsgSemWait waits until a thread uses the DosSemClear function to clear
the semaphore or until a time-out occurs. If no previous thread has set the
semaphore, WinMsgSemWait returns immediately.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
hsem       Identifies the semaphore to set. This value can be the handle of
           a system semaphore that has been previously created or opened by
           using the DosCreateSem or DosOpenSem function, or it can be the
           address of a RAM semaphore.
 
lTimeOut   Specifies how long to wait for the semaphore to clear. If the
           value is greater then zero, this parameter specifies the number
           of milliseconds to wait before returning. If the value is
           SEM_IMMEDIATE_RETURN, the function returns immediately. If the
           value is SEM_INDEFINITE_WAIT, the function waits indefinitely.
 
Return Value
 
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be one of the following:
 
     ERROR_EXCL_SEM_ALREADY_OWNED
     ERROR_INTERRUPT
     ERROR_INVALID_HANDLE
     ERROR_SEM_TIMEOUT
 
Comments
 
This function is identical to DosSemWait except that in addition to waiting
on the specified semaphore, window messages sent via the WinSendMsg function
by another thread may be received.
 
See Also
 
DosCreateSem, DosOpenSem, DosSemClear, DosSemWait, WinMsgMuxSemWait,
WinSendMsg