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 终止进程 中断进 ...
随机推荐
- HttpWebRequest Post请求webapi
1.WebApi设置成Post请求在方法名加特性[HttpPost]或者方法名以Post开头如下截图: 2.使用(服务端要与客户端对应起来)[单一字符串方式]:注意:ContentType = &qu ...
- mysql在控制台里出现中文问号问题
由于重装了wampserver,之前遇到的问题统统会重新出现,那么今天遇到的是在mysql控制台中,在表里输入中文数据,却出现问号的问题: 那么这个就跟编码有关系了,那么,我们就去wampserver ...
- May 7th 2017 Week 19th Sunday
A chain is no stronger than its weakest link. 链条的坚固程度取决于它最薄弱的环节. The same as the well-known buckets ...
- IOS 多线程-NSThread 和线程状态
@interface HMViewController () - (IBAction)btnClick; @end @implementation HMViewController - (void)v ...
- C#后台unxi时间戳转换为前台JS时间的方法
后台返回的时间是一个格式为 /Date(1530153274362)/ 的unxi时间戳前台转换代码:var matchResult = data.match(/(\d+)/);if (matchRe ...
- CodeForces 506D Mr. Kitayuta's Colorful Graph
brute force ? 其实是平方分解.很容易想到的是每一个颜色建一个图,然后并查集维护一下连通性. 问题在于颜色有O(m)种,每种颜色的图点数都是O(n)的,因此并查集的空间只能重复利用. 但是 ...
- python 造轮子(一)——序列与字典
虽然说造轮子很少用了,什么底层东西很少写,但是还是很想学扎实,还是好多东西还是的会,没有底层的支持,比较高级的库学起来还是很困难的. 序列的普遍用法: #-*-coding:utf8-*- #索引 l ...
- Java 文件切割工具类
Story: 发送MongoDB 管理软件到公司邮箱,工作使用. 1.由于公司邮箱限制附件大小,大文件无法发送,故做此程序用于切割大文件成多个小文件,然后逐个发送. 2.收到小文件之后,再重新组合成原 ...
- Shell编程学习之重定向
这一篇讲一下重定向 有些时候你想要保存某些命令产生的输出而不是在显示器上显示它. 为了应对这样的问题 bash shell 也就提供了一些重定向的操作符. 我们先了解一些基本的应用. 输出重定向 输出 ...
- Java删除文件或目录及目录下所有文件
一直在做C++相关开发的工作.突然某一天一时兴起,想学习下Java开发.然后再网上找到一本Java简明教程,入门是够用了.看到文件IO这一章,想起之前用C++做的删除文件或目录的练习,于是打算用Jav ...