OpenersNotesSection(Spacer1)Details

WSSetSignalHandlerFromFunction() 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.

WSSetSignalHandlerFromFunction() returns WSEOK if no error occurs and one of the other error codes as listed in (RefLink[wstp.h, paclet:ref/file/wstp.h]) in the event of an error.

WSSetSignalHandlerFromFunction() is declared in the WSTP header file (RefLink[wstp.h, paclet:ref/file/wstp.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

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

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

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

void f(WSENV ep)
{
	int err;
	err = WSSetSignalHandlerFromFunction(ep, SIGHUP, (void *)h);
	if(err != WSEOK)
		{ /* unable to set the signal handler in ep */ }
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSSetSignalHandler(), paclet:ref/c/WSSetSignalHandler])  ▪  (NonWLLink[WSUnsetSignalHandler(), paclet:ref/c/WSUnsetSignalHandler])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[WSTP C API Developer Guide (Mac OS X), paclet:tutorial/WSTPDeveloperGuide-MacintoshOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Unix and Linux), paclet:tutorial/WSTPDeveloperGuide-UnixOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Windows), paclet:tutorial/WSTPDeveloperGuide-WindowsOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Alphabetical Listing of WSTP C Functions, paclet:guide/AlphabeticalListingOfWSTPCFunctions])}})}})