WSSetSignalHandler (C 函数)
int WSSetSignalHandler(WSENV env,int s,void *sa)
为 WSTP 库信号处理机制中的信号 s 安装对象 sa 详细描述的 Unix 信号处理程序.
范例
基本范例 (1)
#include <signal.h>
#include "wstp.h"
void app_signal_handler(int signum)
{
/* ... */
}
/* set a signal handler in the WSTP environment */
void f(WSENV ep)
{
struct sigaction sa;
int err;
sa.sa_handler = (void (*)(int))app_signal_handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
/* install app_signal_handler for SIGHUP */
err = WSSetSignalHandler(ep, SIGHUP, (void *)&sa);
if(err != WSEOK)
{ /* unable to set the signal handler in ep */ }
}