- int main(int argc, char *argv[])
- {
- signal(SIGINT, sig_int);//注册信号 捕获SIGINT(中断)信号,然后调用sig_int函数 (Ctrl-C会产生这个信号)
- return 0;
- }
- /*SIGINT信号截取函数*/
- static void sig_int(int num)
- {
- Worker_ScheduleStop();
- return;
- }
- //该片段来自于http://www.codesnippet.cn/detail/131120137125.html
来源: http://www.codesnippet.cn/detail/131120137125.html