⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p8-4.c

📁 SUN Solaris8平台下进程间通信
💻 C
字号:
#include <signal.h>void termination_handler(int signum){     struct temp_file *p;     for (p = temp_file_list; p; p = p->next)         unlink (p->name);}int main (void){    ...    struct sigaction new_action, old_action;    /* 设置sigaction结构指明信号动作. */    new_action.sa_handler = termination_handler;    sigemptyset(&new_action.sa_mask);    new_action.sa_flags = 0;    /* 分别查询各个信号的当前设置,仅当它们不是SIG_IGN时才设置新的句柄 */    sigaction(SIGINT, NULL, &old_action);    if (old_action.sa_handler != SIG_IGN)        sigaction (SIGINT, &new_action, NULL);    sigaction(SIGHUP, NULL, &old_action);    if (old_action.sa_handler != SIG_IGN)        sigaction (SIGHUP, &new_action, NULL);    sigaction(SIGTERM, NULL, &old_action);    if (old_action.sa_handler != SIG_IGN)        sigaction (SIGTERM, &new_action, NULL);    ...}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -