DosExitCritSec (OS/2 1.x)

From EDM2
Revision as of 23:15, 25 January 2020 by Ak120 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This call restores normal thread dispatching for the current process.

Syntax

DosExitCritSec ()

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 485 ERROR_CRITSEC_UNDERFLOW

Remarks

A count is maintained of the number of times a DosEnterCritSec request is made without a corresponding DosExitCritSec. The count is incremented by DosEnterCritSec and decremented by DosExitCritSec. Normal thread dispatching is not restored until the count is 0.

The outstanding DosEnterCritSec count is maintained in a word. If overflow occurs, the count is set to the maximum value, no operation is performed, and the request returns with an error.

Bindings

C

#define INCL_DOSPROCESS

USHORT  rc = DosExitCritSec(VOID);

USHORT  rc;            /* return code */

MASM

EXTRN  DosExitCritSec:FAR
INCL_DOSPROCESS     EQU 1

CALL   DosExitCritSec

Returns WORD

Example Code

This example enters a section that will not be pre-empted, performs a simple task, and then exits quickly.

#define INCL_DOSPROCESS

  DosEnterCritSec();   /* Enter critical code section */
  flag = TRUE;         /* Perform some work */
  DosExitCritSec();    /* Exit critical code section */