win32 signal
The signal function enables a process to choose one of several ways to handle an interrupt signal from the operating system. The sig argument is the interrupt to which signal responds; it must be one of the following manifest constants, which are defined in SIGNAL.H.
|
sig value |
Description |
|---|---|
|
SIGABRT |
Abnormal termination |
|
SIGFPE |
Floating-point error |
|
SIGILL |
Illegal instruction |
|
SIGINT |
CTRL+C signal |
|
SIGSEGV |
Illegal storage access |
|
SIGTERM |
Termination request |
If sig is not one of the above values, the invalid parameter handler is invoked, as defined in Parameter Validation . If execution is allowed to continue, this function sets errno to EINVALand returns SIG_ERR.
By default, signal terminates the calling program with exit code 3, regardless of the value of sig.
Example :
int main(void)
{ typedef void (*SignalHandlerPointer)(int); SignalHandlerPointer previousHandler;
previousHandler = signal(SIGABRT, SignalHandler);
previousHandler = signal(SIGINT, SignalHandler);
previousHandler = signal(SIGTERM, SignalHandler);
previousHandler = signal(SIGBREAK, SignalHandler); //abort();
while ()
{
Sleep();
}
void SignalHandler(int signal)
{
if (signal == SIGABRT)
{
// abort signal handler code
} else
{
// ...
} printf("____ signal: %d \n", signal);
}
http://msdn.microsoft.com/en-us/library/xdkz3x12.aspx
Send signal
win32 signal的更多相关文章
- 转:RTMPDump源代码分析
0: 主要函数调用分析 rtmpdump 是一个用来处理 RTMP 流媒体的开源工具包,支持 rtmp://, rtmpt://, rtmpe://, rtmpte://, and rtmps://. ...
- rtmpdump代码分析 转
RTMPdump 源代码分析 1: main()函数 rtmpdump 是一个用来处理 RTMP 流媒体的工具包,支持 rtmp://, rtmpt://, rtmpe://, rtmpte://, ...
- rpcz VC2010 构建
rpcz VC2010 构建 rpcz 是应用ZeroMQ和Protobuf开发的RPC. 见: https://github.com/reinferio/rpcz 及 https://code.go ...
- 【PHP源码】PHP 函数调用
title: [PHP 源码]PHP 函数调用 date: 2020-03-30 23:25:00 updated: 2020-04-04 19:57:00 tags: PHP 源码 想法 我以前对于 ...
- multiprocessing 让子进程忽略信号,手动关闭子进程
起因 同事想要写一个代码,主进程中监听SIGINT.SIGTERM信号退出,并关闭启动的子进程,代码类似这样 import signal import sys import time from mul ...
- Serial Port Programming using Win32 API(转载)
In this tutorial we will learn How to communicate with an external device like a microcontroller boa ...
- Microsoft Win32 to Microsoft .NET Framework API Map
Microsoft Win32 to Microsoft .NET Framework API Map .NET Development (General) Technical Articles ...
- python signal信号
作用:发送和接收异步系统信号 信号是一个操作系统特性,它提供了一个途径可以通知程序发生了一个事件并异步处理这个事件.信号可以由系统本身生成,也可以从一个进程发送到另一个进程. 由于信号会中断程序的正常 ...
- python signal(信号)
信号的概念 信号(signal)-- 进程之间通讯的方式,是一种软件中断.一个进程一旦接收到信号就会打断原来的程序执行流程来处理信号. 几个常用信号: SIGINT 终止进程 中断进 ...
随机推荐
- 如何在js中获取到服务器端控件并给其赋值
如下所示:lbID为服务器端控件ID document.getElementById('<%=lbID.ClientID%>').value = "赋值";
- jupyter notebook 报错 ImportError: No module named matplotlib
解决办法: 打开Anaconda Prompt 列出conda环境: conda info --envs 结果显示: # conda environments: # tensorflow * D:\ ...
- Socket连接时,端口是怎么分配的
socket 客户端连接socket 的端口每个是唯一的,每个新的连接,端口号+1 从1024-65534 最大到65534 然后再开始循环 中间遇到已经使用的端口就跳过
- leetcode: 树
1. sum-root-to-leaf-numbers Given a binary tree containing digits from0-9only, each root-to-leaf pat ...
- Facebook interview problem:13. Roman to Integer
description: Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symb ...
- 修改hosts工具推荐SwitchHosts
推荐一个修改hosts的工具.适合平时工作中经常修改hosts的开发测试. 下载地址:https://oldj.github.io/SwitchHosts/ 可以按各种环境或者项目添加,用的时候打开或 ...
- 使用ssl模块配置同时支持http和https并存
博客已经迁移,请访问: https://www.helingfeng.com
- Ubuntu ndk环境变量配置
https://blog.csdn.net/gulingfengze/article/details/70149092 用source /etc/profile,有些博客写的使用sudo gedit ...
- ref 微软官网
https://docs.microsoft.com/zh-cn/previous-versions/14akc2c7(v=vs.110)
- leanote开源云笔记
下载链接 http://yunpan.cn/cZ42hEEQcYMMz (提取码:16a1)