### OS/2 APIs That Interfere with Exception Handling

When you use the IBM C and C++ Compilers default exception handlers, avoid the following OS/2 APIs because they can interfere with exception handling:

OS/2 API | Description | Alternative
--- | --- | ---
DosCreateThread | This API does not automatically register an exception handler for the new thread. | Call _beginthread, or use #pragma handler to register the handler for the thread the function that gets control when the thread starts.
DosExit | This API does not perform all necessary library termination routines. | Use exit or _exit, abort, or _endthread, or simply fall out of main.
DosUnwindException | This API can unwind or remove the IBM C and C++ Compilers exception handlers from the stack. | Use longjmp.
DosSetSignalExceptionFocus | Using this API to remove the signal focus from an IBM C and C++ Compilers application may prevent you from receiving SIGINT and SIGBREAK exceptions from the keyboard. |
DosAcknowledgeSignalException | This API interferes with the IBM C and C++ Compilers handling of signal exceptions. | The library exception handler acknowledges signals for you.
DosEnterMustComplete | This API can be used to delay the handling of asynchronous exceptions, including termination exceptions, until a section of code has ended. You must call DosExitMustComplete at the end of the section to re-enable the exception handling. |
DosEnterCritSec | This API prevents execution from switching between threads until a section of code has ended. You must call DosExitCritSec at the end of the critical section of code. Use this API only if you cannot use a mutex semaphore. If you must use it, keep critical sections short and avoid including calls that may get blocked. |

Signals and Exceptions

Write or Register an Exception Handler