Jump to content

DosEnterMustComplete: Difference between revisions

From EDM2
Ak120 (talk | contribs)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Description==
Provides entry into a section of code in which asynchronous exceptions are held.
Provides entry into a section of code in which asynchronous exceptions are held.


==Syntax==
==Syntax==
<PRE>
DosEnterMustComplete(pulNesting)
#define INCL_DOSEXCEPTIONS
#include <os2.h>


PULONG   pulNesting;  /*  A pointer to a value that is equal to the number of DosEnterMustComplete requests minus the number of DosExitMustComplete requests for the current thread. */
==Parameters==
APIRET    ulrc;        /*  Return Code. */
;pulNesting (PULONG) - output : A pointer to a value that is equal to the number of DosEnterMustComplete requests minus the number of DosExitMustComplete requests for the current thread.
 
ulrc = DosEnterMustComplete(pulNesting);


</PRE>
==Parameters==
;  pulNesting (PULONG) - output : A pointer to a value that is equal to the number of DosEnterMustComplete requests minus the number of DosExitMustComplete requests for the current thread.
==Return Code==
==Return Code==
ulrc (APIRET) - returns
;ulrc (APIRET) - returns:DosEnterMustComplete returns one of the following values:
 
* 0 NO_ERROR
DosEnterMustComplete returns one of the following values:
*650 ERROR_NESTING_TOO_DEEP
 
* 0     NO_ERROR  
* 650       ERROR_NESTING_TOO_DEEP  


==Remarks==
==Remarks==
Line 27: Line 16:


DosEnterMustComplete notifies the system that the thread is entering a section of code in which asynchronous exceptions (signals and asynchronous process terminations) are to be held, rather than being immediately delivered to the thread.
DosEnterMustComplete notifies the system that the thread is entering a section of code in which asynchronous exceptions (signals and asynchronous process terminations) are to be held, rather than being immediately delivered to the thread.


==Example Code==
==Example Code==
This example shows how a thread can notify the system to hold asynchronous exceptions during a section of code.
{{OS2API Example MustComplete}}
<PRE>
#define INCL_DOSEXCEPTIONS  /* Exception values */
#define INCL_DOSERRORS      /* Error values */
#include <os2.h>
#include <stdio.h>
 
int main(VOID)
  {
  ULONG  ulNestLevel = 0;  /* Global variable tracking nesting
                                of DosEnterMustComplete calls    */
  APIRET  rc = NO_ERROR;    /* Return code                      */
 
    rc = DosEnterMustComplete(&ulNestLevel);
 
    if (rc != NO_ERROR) {
        printf("DosEnterMustComplete error: return code = %u\n",rc);
        return 1;
    } else {
        printf("ulNestLevel = %u\n",ulNestLevel);
    }
 
        /* ADD BLOCK OF CODE THAT MUST COMPLETE HERE... */


    rc = DosExitMustComplete(&ulNestLevel);
    if (rc != NO_ERROR) {
        printf("DosExitMustComplete error: return code = %u\n",rc);
        return 1;
    } else {
        printf("ulNestLevel = %u\n",ulNestLevel);
    }
    return NO_ERROR;
    }
</PRE>
==Related Functions==
==Related Functions==
* [[OS2 API:CPI:DosAcknowledgeSignalException|DosAcknowledgeSignalException]]
* [[DosAcknowledgeSignalException]]
* [[OS2 API:CPI:DosExitMustComplete|DosExitMustComplete]]
* [[DosExitMustComplete]]
* [[OS2 API:CPI:DosRaiseException|DosRaiseException]]
* [[DosRaiseException]]
* [[OS2 API:CPI:DosSendSignalException|DosSendSignalException]]
* [[DosSendSignalException]]
* [[OS2 API:CPI:DosSetExceptionHandler|DosSetExceptionHandler]]
* [[DosSetExceptionHandler]]
* [[OS2 API:CPI:DosSetSignalExceptionFocus|DosSetSignalExceptionFocus]]
* [[DosSetSignalExceptionFocus]]
* [[OS2 API:CPI:DosUnsetExceptionHandler|DosUnsetExceptionHandler]]
* [[DosUnsetExceptionHandler]]
* [[OS2 API:CPI:DosUnwindException|DosUnwindException]]
* [[DosUnwindException]]
 


[[Category:The OS/2 API Project]]
[[Category:Dos]]

Latest revision as of 18:01, 15 January 2019

Provides entry into a section of code in which asynchronous exceptions are held.

Syntax

DosEnterMustComplete(pulNesting)

Parameters

pulNesting (PULONG) - output
A pointer to a value that is equal to the number of DosEnterMustComplete requests minus the number of DosExitMustComplete requests for the current thread.

Return Code

ulrc (APIRET) - returns
DosEnterMustComplete returns one of the following values:
  • 0 NO_ERROR
  • 650 ERROR_NESTING_TOO_DEEP

Remarks

Note: Do not make Presentation Manager calls from exception handlers.

DosEnterMustComplete notifies the system that the thread is entering a section of code in which asynchronous exceptions (signals and asynchronous process terminations) are to be held, rather than being immediately delivered to the thread.

Example Code

This example shows how a thread can notify the system to hold asynchronous exceptions during a section of code.

#define INCL_DOSEXCEPTIONS   /* Exception values */
#define INCL_DOSERRORS       /* Error values */
#include <os2.h>
#include <stdio.h>

int main(VOID) {
  ULONG   ulNestLevel = 0;  /* Global variable tracking nesting
                               of DosEnterMustComplete calls     */
  APIRET  rc = NO_ERROR;    /* Return code                       */

  rc = DosEnterMustComplete(&ulNestLevel);

  if (rc != NO_ERROR) {
       printf("DosEnterMustComplete error: return code = %u\n",rc);
       return 1;
  } else {
       printf("ulNestLevel = %u\n",ulNestLevel);
  }

      /* ADD BLOCK OF CODE THAT MUST COMPLETE HERE... */

  rc = DosExitMustComplete(&ulNestLevel);

  if (rc != NO_ERROR) {
      printf("DosExitMustComplete error: return code = %u\n",rc);
      return 1;
  } else {
      printf("ulNestLevel = %u\n",ulNestLevel);
  }

  return NO_ERROR;
}

Related Functions