DosExit

DosExit ends the current or all threads in a process and gives a result code to be passed to another thread when calling DosWaitChild. If the thread ended was the last thread or all threads are ended, then the whole process is ended.

Syntax
DosExit( ulAction, ulResult );

Parameters
Value Name          Description 0     EXIT_THREAD   The current thread is ended. If the current thread is the last thread, the process is ended. 1     EXIT_PROCESS  The process and all threads in it is ended.
 * ULONG ulAction (input): Ends one or all threads of the process. Values are:
 * ULONG ulResult (input)
 * Program completion code passed to any thread that issues DosWaitChild for the current process.

Include Info

 * 1) define INCL_DOSPROCESS
 * 2) include 

Gotchas
Do not end thread 1 (ie. the main thread) without ending the process.

Sample Code
DosExit(1,4711);  /* End all threads and the process, */ /* and pass the value 4711 to any  */ /* thread doing DosWaitChild on this process */
 * 1) define INCL_DOSPROCESS
 * 2) include 