.NET/Link API Version 1.7 USE FRAMES

IKernelLink.AbortEvaluation Method 

Sends a request to the kernel to abort the current evaluation.

[Visual Basic]
Sub AbortEvaluation()
[C#]
void AbortEvaluation();

Remarks

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 abort the computation so that the main thread does not have to continue waiting, you can call AbortEvaluation on some other thread (perhaps in response to some user action like clicking an "abort" button). The Mathematica computation will terminate and return the symbol $Aborted.

Be aware that Mathematica is not always in a state where it is receptive to abort requests. A quick return of $Aborted is not always guaranteed.

What this method does is simply use PutMessage to send a MathLinkMessage.Abort to the kernel. It is provided as a convenience to shield programmers from such low-level details.

See Also

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