DosExit

From EDM2
Jump to: navigation, search

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

ULONG ulAction (input)
Ends one or all threads of the process. Values are:
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 ulResult (input)
Program completion code passed to any thread that issues DosWaitChild for the current process.

Include Info

#define INCL_DOSPROCESS
#include <os2.h>

Gotchas

Do not end thread 1 (i.e. the main thread) without ending the process.

Sample Code

#define INCL_DOSPROCESS
#include <os2.h>

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

See Also