A thread is terminated when any of the following occurs:
The FINISH condition is raised only in the thread initiating program termination. Any ON-units established within the thread are given control before the thread actually terminates.
Except as noted above, when a thread terminates, no other threads are terminated, unless the thread being terminated is the main thread. In that case, all other threads are stopped and terminated before the main thread is terminated.
When a thread terminates, only its stack space is released. All other resources such as allocated storage, open files, etc. remain intact. The user must ensure that any resources a thread has acquired are released and open files are closed, unless they are needed by other threads that are still active.
When the main thread terminates, all resources are released and files are closed.