INtime® 3.1 Software - tenAsys
INtime® 3.1 Software - tenAsys
INtime® 3.1 Software - tenAsys
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Appendix B: The iwin32 subsystem<br />
A process can refer to itself by a so-called pseudo handle, which is not a fixed value,<br />
but must be obtained by the GetCurrentProcess function. A pseudo handle can only be<br />
used by the process itself, and it cannot be closed (it is implicitly closed when the<br />
process terminates).<br />
A process can be explicitly terminated with the TerminateProcess or ExitProcess<br />
functions; implicit termination obeys these rules:<br />
• When the primary thread returns, the process is terminated.<br />
• When the primary thread calls ExitThread explicitly, the process is not terminated.<br />
• When any thread terminates and it was the last thread in the process, the process is<br />
terminated.<br />
Terminating a process does not necessarily delete the process! It only closes the pseudo<br />
handle for the process and only if that is the last handle, the process is deleted. When a<br />
process is terminated, all handles created by its threads are closed; again, this need not<br />
imply that all objects are deleted.<br />
Waiting for a process to be signaled means waiting until the process has terminated.<br />
Process functions include:<br />
iwin32 calls<br />
iwin32x calls<br />
ExitProcess or RtExitProcess –<br />
GetCurrentProcess –<br />
GetCurrentProcessId –<br />
GetExitCodeProcess or RtGetExitCodeProcess RtGetExitCodeProcess<br />
OpenProcess or RtOpenProcess<br />
RtOpenProcess<br />
TerminateProcess or RtTerminateProcess RtTerminateProcess<br />
CreateProcess or CreateRtProcess<br />
RtCreateProcess<br />
WaitForMultipleObjects or<br />
RtWaitForMultipleObjects<br />
RtWaitForMultipleObjects<br />
WaitForSingleObject or RtWaitForSingleObject RtWaitForSingleObjects<br />
Threads<br />
A thread is the active element type in the system. Each thread has a priority, a state and<br />
a stack. The priority indicates the importance of the thread when it is in the ready<br />
state.<br />
A thread is in one of these states:<br />
• Ready: The thread wants to execute; out of the set of ready threads (called the<br />
ready list) the thread with the best priority becomes the running thread.<br />
143