.NET/Link API Version 1.5 USE FRAMES

IKernelLink.InterruptEvaluation Method 

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

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


Interrupt requests should not be confused with abort requests. Interrupt requests generate a special MenuPacket from the kernel that needs a response. You must be prepared to handle this packet if you call InterruptEvaluation. Most programmers want to simply abort the evaluation--use AbortEvaluation for that.

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 interrupt the computation to provide your users with choices ("abort", "continue", "enter dialog", etc.), you can call InterruptEvaluation on some other thread (perhaps in response to the user clicking an "interrupt" button).

Be aware that Mathematica is not always in a state where it is receptive to interrupt requests.

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

See Also

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