home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************\
- *
- *
- * PROCEDURE - Critical Region Guards
- *
- * PURPOSE - From DESQview API Manual:
- * The BEGINC call causes the current task to enter a
- * critical region during which all multitasking is
- * suspended. The calling task is allowed to continue
- * execution until it calls ENDC or voluntarily gives up
- * control. If it voluntarily gives up control (by
- * waiting for keyboard input for instance) multitasking
- * is allowed to resume until the task regains control,
- * at which time multitasking is again suspended. This
- * facility can be useful for executing time critical
- * sections of code and for controlling access to common
- * resources. It should be used sparingly to avoid
- * degrading overall system performance.
- *
- * If another task is using DOS when the BEGINC call is
- * made, the caller will be suspended until DOS is free.
- * This means that you are free to call DOS from inside
- * a critical region.
- *
- * The ENDC call defines the end of a critical region of
- * code. Critical regions are entered via the BEGINC
- * call. Calls to BEGINC and ENDC may be nested.
- * Multitasking does not resume until an ENDC call has
- * been executed for every BEGINC call that has been made.
- *
- * GENERAL ALGORITHM - Call the DESQview API BEGINC or ENDC routines.
- *
- * INPUT - none.
- *
- * OUTPUT - none.
- *
- * SYSTEM - Borland's Turbo C++ v1.0 on an EPSON EQUITY III+
- * running MS-DOS v4.01 & DESQview v2.26. Should operate
- * under any MS/PC-DOS 2.x or greater & DESQview 2.x or
- * greater.
- *
- * HISTORY:
- * 90-07-28 - Initiated Mark Potter
- *
- \***************************************************************************/
-
- #include <dos.h>
- #include "dvaware.h"
-
- // begin critical region,
- // no time slicing.
- void dv_beginc( // procedure
- void // no parameters
- ) {
- _AX = 0x101B; // BEGINC DV API call
- geninterrupt( 0x15 ); // DV API CALL
- }
-
-
- // end critical region,
- // allow time slicing.
- void dv_endc( // procedure
- void // no parameters
- ) {
- _AX = 0x101C; // ENDC DV API call
- geninterrupt( 0x15 ); // DV API CALL
- }
-
- // END DVCRIT.CPP
-