为什么SIGTERM在Windows上不起作用
Why doesn't SIGTERM Works On Windows
这是我的代码:
void signalHandler(int sigNum) {
OutputDebugStringA("i'm terminatedn");
exit(sigNum);
}
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPTSTR lpCmdLine,
_In_ int nCmdShow)
{
signal(SIGTERM, signalHandler);
while (1)
{
Sleep(100);
}
return 0;
}
当我通过Windows taskmgr终止它时,调试字符串没有显示。我的代码有问题吗?
Windows不像
Unix系统那样使用信号。
例如,它不会生成 SIGTERM。
TaskManager
使用TerminateProcess
API 调用来终止选定的进程。终止的进程不会收到任何通知。所以你不能用SIGTERM
信号来处理它。
相关文章:
- Windows.h 输入在函数之外不起作用
- C++Windows API MOUSEEVENTF_XDOWN,MOUSEEVENTF_XUP不起作用
- boost zlib filter 在 Windows 中不起作用
- 在 Windows 上打印不起作用
- Makefile在Linux中工作,但在Windows下不起作用,在子目录中找不到文件
- QClipboard的信号选择已更改在Windows 7中不起作用
- 当我在Windows上运行它时,为什么我的Linux编译二进制不起作用
- 提升协程是否在 Windows x86_64 上不起作用
- 唯一的字符代码在 Linux 中运行时不起作用,但在 Windows (C++) 中很好
- 在 Windows 8 中编译的 DLL 在 Windows 7 中不起作用
- Visual C 2012 Express Compied Application在Windows XP上不起作用
- MinGW .h 编译文件不起作用:此文件的版本与您运行的 Windows 版本不兼容
- outputdebugstring,printf不起作用(Visual Studio 2012,Windows 8)
- getenv( "LINES" ) 在 Windows 上不起作用
- EDSDK消息循环在Windows 8.1下不起作用
- 注入dll在windows XP上不起作用
- MS Windows套接字示例对我不起作用
- 在Windows 7下编译的Dll在Windows XP中不起作用
- 在 Windows 7 上中止系统关闭不起作用
- perl 内联 cpp 在 Windows 32 位上不起作用