LibraryLink`
LibraryLink`

AbortQ (C Function)

returns TRUE if the Wolfram Language is in the process of an abort.

Details

  • Used in C/C++ code in a library function called from the Wolfram Language.
  • Code that runs for a long time should call AbortQ to see if the user has aborted the computation.
  • Calling AbortQ is the correct way to ensure that your function yields not only to aborts, but also to preemptive requests for evaluation, such as those which might be issued by controls and dynamic constructs in the notebook front end.
  • Any WSLINK objects which were passed into the function or created by getWSLINK will be discarded after the abort has been detected. It is not necessary to clean up these links as a part of handling an abort.

Examples

Basic Examples  (1)

This allows a long computation to be abortable from the Wolfram Language:

while( !longTaskComplete()) {
doSomething();
if (libData->AbortQ()) {
return;
}
}