Go up to Miscellaneous
Go forward to
stop(): Stopping a Thread
Specification: Hints to the system that the result of the thread to which t is bound is not needed any more.
Constraints: It is illegal to call this procedure, if t is not
bound to any thread. Any further application
Wait(s) is illegal
if is bound to the same thread as t.
Note: Since unreferenced threads are automatically reclaimed during garbage collection, it is not necessary to explicitly stop a thread. The only purpose of this facility is to guarantee that an unused and not yet activated thread is not activated before the next garbage collection takes place.
Implementation: If the thread is not yet activated, it is removed from the lazy thread stack. If the thread has been already activated, it will not be put back into the ready queue after the next preemption. If any other thread waits for the result of such a thread, it will be blocked forever (deadlock).