Sends a request to the kernel to shut down.
This method is safe to call from any thread. Any method that is blocking waiting for a result from Mathematica (such as WaitForAnswer) will return immediately and throw a MathLinkException. You will typically call Close immediately after TerminateKernel, as the link will die when the kernel quits.A typical usage scenario is as follows. You have a thread that is blocking in WaitForAnswer waiting for the result of some computation, and you decide that it must return right away and you are willing to sacrifice the kernel to guarantee this. You then call AbandonEvaluation on a separate thread. This causes WaitForAnswer to immediately throw a MathLinkException. You catch this exception, discover that ClearError returns false indicating that the link is hopeless, and then you call TerminateKernel followed by Close. The reason TerminateKernel is useful here is that because you called AbandonEvaluation, the kernel may still be computing and it may not die when you call Close. You call TerminateKernel to give it a little help.
What this method does is simply use PutMessage to send a MathLinkMessage.Terminate to the kernel. It is provided as a convenience to shield programmers from such low-level details.