Jump to content

DosExit: Difference between revisions

From EDM2
Ak120 (talk | contribs)
No edit summary
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
'''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.
'''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===
==Syntax==
DosExit( ''ulAction'', ''ulResult'' );
DosExit( ''ulAction'', ''ulResult'' )


===Parameters===
==Parameters==
;ULONG ''ulAction'' (input): Ends one or all threads of the process. Values are:
;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.
0     EXIT_THREAD   The current thread is ended. If the current thread
::1 EXIT_PROCESS - The process and all threads in it is ended.
                      is the last thread, the process is ended.
;ULONG ''ulResult'' (input): Program completion code passed to any thread that issues DosWaitChild for the current process.
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===
==Include Info==
  #define INCL_DOSPROCESS
  #define INCL_DOSPROCESS
  #include <os2.h>
  #include <os2.h>


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


===Sample Code===
==Sample Code==
  #define INCL_DOSPROCESS
  #define INCL_DOSPROCESS
  #include <os2.h>
  #include <os2.h>

Latest revision as of 18:24, 29 August 2021

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