IKernelLinkAbortEvaluation Method

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

Definition

Namespace: Wolfram.NETLink
Assembly: Wolfram.NETLink (in Wolfram.NETLink.dll) Version: 2.0.0.0
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 the Wolfram Language. 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 Wolfram Language computation will terminate and return the symbol $Aborted.

Be aware that the Wolfram session 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