dos12.hlp (Table of Contents; Topic list)
DosHoldSignal (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_DOSSIGNALS
 
USHORT DosHoldSignal(fDisable)
USHORT fDisable;    /* disable/enable signals */
 
The DosHoldSignal function disables or enables signal processing for the
current process.
 
The DosHoldSignal function is a family API function.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
fDisable   Specifies whether to disable or enable signals that are intended
           for the current process. If this parameter is HLDSIG_DISABLE, the
           function disables signals. If it is HLDSIG_ENABLE, the function
           enables signals and restores the request count to its value
           before the last call to DosHoldSignal.
 
Return Value
 
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be the following:
 
     ERROR_INVALID_FUNCTION
 
Comments
 
If the fDisable parameter is HLDSIG_DISABLE, the function holds all signals
without processing them until DosHoldSignal is called again with fDisable
set to HLDSIG_ENABLE. Signals should be held for as little time as possible;
if necessary, a signal should be released and then held again.
 
Requests to disable and enable signal processing are cumulative. This means
two requests to disable processing must be followed by two requests to
enable processing before processing is enabled.
 
The DosHoldSignal function is intended to be used by library routines,
subsystems, and similar code that need to prevent a possible signal from
interfering with the completion of the current activity──for instance,
activity in locked segments or in temporarily reserved resources.
 
Restrictions
 
In real mode, the following restriction applies to the DosHoldSignal
function:
 
♦  Only the signal interrupt (SIG_CTRLC) and signal break (SIG_CTRLBREAK)
   signals are recognized.
 
Example
 
This example calls the DosHoldSignal function to disable signals and calls
the DosEnterCritSec function to stop all other threads. When the processing
of the critical section of code is completed, the DosHoldSignal function
enables signals again:
 
DosHoldSignal(HLDSIG_DISABLE);       /* disables signals        */
DosEnterCritSec();                   /* enters critical section */
    .
    .
    .
DosExitCritSec();                    /* exits critical section  */
DosHoldSignal(HLDSIG_ENABLE);        /* enables signals         */
 
See Also
 
DosCLIAccess, DosEnterCritSec, DosFlagProcess