subcalls.hlp (Topic list)
MouSynch (1.2)
Overview  Changes                                 Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_MOU
 
USHORT MouSynch(fWait)
USHORT fWait;    /* wait/no-wait flag */
 
The MouSynch function synchronizes access to the mouse. This function should
be used by a Mou subsystem to prevent more than one process from accessing
the mouse handle at any one time.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
fWait      Specifies whether to wait if the mouse device driver is currently
           busy. If this parameter is FALSE, the function returns control
           immediately without waiting for the device to become free. If
           this parameter is TRUE, the function waits until the mouse handle
           is free.
 
Return Value
 
The return value is zero if the function is successful. Otherwise, it is an
error value.
 
Comments
 
The MouSynch function requests an exclusive system semaphore that clears
when the Mou subsystem returns to the mouse router. The MouSynch function
blocks all other threads within a screen group until the semaphore clears.
 
A registered mouse subsystem should not issue the MouSynch function when the
base video subsystem (BVS) issues MouOpen and MouClose functions. A
registered mouse subsystem must provide the required level of serialization
for the MouOpen and MouClose functions without calling MouSynch. This
special processing is required because MouOpen and MouClose are issued by
BVS on the VioSetMode path. The VioSetMode function can be issued, in turn,
by a VioSavRedrawWait thread. You can assume the synchronization semaphore
was already held by another thread blocked by a call to the MouReadEventQue
function.
 
Note that if a save/redraw wait thread issues the VioSetMode function, and
if BVS in turn issues the MouOpen or MouClose function and the mouse
subsystem in turn issues the MouSynch function, the screen switch will be
blocked and the system will "hang."
 
See Also
 
DosCloseSem, DosDevIOCtl, MouClose, MouOpen, MouReadEventQue, MouRegister,
VioSavRedrawWait, VioSetMode