.NET/Link API Version 1.7 USE FRAMES

IKernelLink.AbandonEvaluation Method 

Causes any method that is blocking waiting for output from the kernel to return immediately and throw a MathLinkException.

[Visual Basic]
Sub AbandonEvaluation()
void AbandonEvaluation();


This is a "last-ditch" method when you absolutely need to break out of any methods that are waiting for a result from the kernel. You should should always close the link after you call this.

This method is typically called from a different thread than the one that is performing the computation. That "computation" thread is typically blocking in WaitForAnswer or some other method that is waiting for the result to arrive from Mathematica. If you want to force that method to return immediately (it will throw a MathLinkException), call AbandonEvaluation in a different thread.

The code in the catch handler for the MathLinkException will find that ClearError returns false, indicating that the link is irrevocably damaged. You should then call TerminateKernel followed by Close.

See Also

IKernelLink Interface | Wolfram.NETLink Namespace | AbortEvaluation | InterruptEvaluation | TerminateKernel