WSAbort (C Function)

is a global variable set when a program created using mcc or mprep has been sent an abort message.

Details

  • LinkInterrupt[link] can be used to send an abort interrupt from the Wolfram Language to a program connected to a particular link.
  • WSAbort is set to 1 if the program has received an abort message; otherwise the value is 0.
  • WSAbort() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include <math.h>
#include "wstp.h"

/* totals the numbers and calculates the square root */

double f(double* list, int len)
{
    double sum;

    while(len--)
    {
        sum += *list++;
        /* check for the abort */
        if(WSAbort) return (double)0;
    }

    return sqrt(sum);
}