[ Home | Alpha index | Topic index | Tutorials | Download | Feedback ]

The OS/2 API Project

DosExit

[ Syntax | Params | Returns | Include | Usage | Structs | Gotchas | Code | Also ]

Syntax

DosExit( ulAction, ulResult );

Parameters

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

Returns

Include Info

#define INCL_DOSPROCESS
#include <os2.h>

Usage Explanation

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.

Relevant Structures

Gotchas

Do not end thread 1 (ie. 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

DosWaitChild, DosExecPgm

Author

Oscar Gustafsson - oscar@lysator.liu.se

Additions

Last modified September 21/1996
Please send all errors, comments, and suggestions to: timur@vnet.ibm.com

The OS/2 API Project

DosExit