This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
MathLink C Function

MLSetSignalHandlerFromFunction()

int MLSetSignalHandlerFromFunction(MLENV ep, int s, void *sf)
installs the Unix signal handler pointed to by sf for signal s in the MathLink library signal-handling mechanism.
  • MLSetSignalHandlerFromFunction() does nothing on Microsoft Windows.
  • sf is a pointer to a signal-handling function of type void (*func)(int). See the header file signal.h on most Unix and Unix-like systems for further details.
  • MLSetSignalHandlerFromFunction() returns MLEOK if no error occurs and one of the other error codes as listed in mathlink.h in the event of an error.
  • MLSetSignalHandlerFromFunction() is declared in the MathLink header file mathlink.h.
#include <signal.h>
#include "mathlink.h"

void h(int signum)
{
    /* ... */
}

/* set a SIGHUP signal handler in the MathLink environment */

void f(MLENV ep)
{
    int err;
    err = MLSetSignalHandlerFromFunction(ep, SIGHUP, (void *)h);
    if(err MLEOK)
        { /* unable to set the signal handler in ep */ }
}