Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
en:docs:fapi:dosexit [2021/08/20 04:44] – prokushev | en:docs:fapi:dosexit [2021/09/17 13:41] (current) – prokushev | ||
---|---|---|---|
Line 5: | Line 5: | ||
This call is issued when a thread completes executing. The current thread or process ends. | This call is issued when a thread completes executing. The current thread or process ends. | ||
- | ==Syntax== | + | ===== Syntax |
- | | + | <code c> |
+ | DosExit (ActionCode, | ||
+ | </ | ||
- | ==Parameters== | + | ===== Parameters |
- | | + | |
+ | | ||
^ Value ^ Definition ^ | ^ Value ^ Definition ^ | ||
Line 16: | Line 19: | ||
| 1 | All threads in the process end. | | | 1 | All threads in the process end. | | ||
- | *ResultCode (USHORT) - input : Program' | + | *ResultCode ([[USHORT]]) - input : Program' |
+ | |||
+ | ===== Remarks ===== | ||
- | ==Remarks== | ||
DosExit allows a thread to terminate itself or be terminated by another thread in its process. If ActionCode=0 and the specified thread is the last thread executing in the process, or if ActionCode=1, | DosExit allows a thread to terminate itself or be terminated by another thread in its process. If ActionCode=0 and the specified thread is the last thread executing in the process, or if ActionCode=1, | ||
Line 27: | Line 31: | ||
When a process is terminating, | When a process is terminating, | ||
- | ===Family API Considerations=== | + | ==== Family API Considerations ==== |
Some options operate differently in the DOS mode than in the OS/2 mode. Therefore, the following restrictions apply to DosExit when coding for the DOS mode: | Some options operate differently in the DOS mode than in the OS/2 mode. Therefore, the following restrictions apply to DosExit when coding for the DOS mode: | ||
* There is no thread support in DOS 3.3; therefore DosExit exits the currently executing program. | * There is no thread support in DOS 3.3; therefore DosExit exits the currently executing program. | ||
* If ActionCode = 0 this option is ignored. It is equivalent to an ActionCode = 1. | * If ActionCode = 0 this option is ignored. It is equivalent to an ActionCode = 1. | ||
- | ==Example Code== | + | ===== Example Code ===== |
- | ===C Binding=== | + | |
+ | ==== C Binding ==== | ||
+ | <code c> | ||
#define INCL_DOSPROCESS | #define INCL_DOSPROCESS | ||
Line 41: | Line 48: | ||
USHORT | USHORT | ||
+ | </ | ||
In this example, the main routine starts up another program, simple.exe, and then expects a return code of 3 to be returned. Simple.exe sets the return code with DosExit. | In this example, the main routine starts up another program, simple.exe, and then expects a return code of 3 to be returned. Simple.exe sets the return code with DosExit. | ||
+ | <code c> | ||
#define INCL_DOSPROCESS | #define INCL_DOSPROCESS | ||
| | ||
Line 66: | Line 75: | ||
else | else | ||
| | ||
- | | + | </ |
----------------simple.exe------------------ | ----------------simple.exe------------------ | ||
+ | <code c> | ||
#define INCL_DOSPROCESS | #define INCL_DOSPROCESS | ||
| | ||
Line 79: | Line 88: | ||
| | ||
} | } | ||
+ | </ | ||
The following example shows how to suspend and resume execution of a thread within a process. The main thread creates Thread2 and allows it to begin executing. Thread2 iterates through a loop that prints a line and then sleeps, relinquishing its time slice to the main thread. After one iteration by Thread2, the main thread suspends Thread2 and then resumes it. Subsequently, | The following example shows how to suspend and resume execution of a thread within a process. The main thread creates Thread2 and allows it to begin executing. Thread2 iterates through a loop that prints a line and then sleeps, relinquishing its time slice to the main thread. After one iteration by Thread2, the main thread suspends Thread2 and then resumes it. Subsequently, | ||
+ | <code c> | ||
#define INCL_DOSPROCESS | #define INCL_DOSPROCESS | ||
#include < | #include < | ||
Line 144: | Line 154: | ||
DosSleep(SLEEPLONG); | DosSleep(SLEEPLONG); | ||
} | } | ||
+ | </ | ||
- | + | ==== MASM Binding ==== | |
- | ===MASM Binding=== | + | <code asm> |
EXTRN DosExit:FAR | EXTRN DosExit:FAR | ||
Line 154: | Line 165: | ||
PUSH | PUSH | ||
CALL | CALL | ||
+ | </ | ||
+ | ===== Note ===== | ||
- | === Note === | ||
This text based on [[http:// | This text based on [[http:// |