当前位置: 首页 > news >正文

如何做制作头像的网站女装关键词排名

如何做制作头像的网站,女装关键词排名,国内最好的erp系统,哪个网站可以免费学设计学习分享 1、信号的基本概念2、查看信号列表3、常见信号名称4、signal库函数5、发送信号kill6、kill - signal (无参信号)示例6.1、kill - signal (不可靠信号)示例6.2、kill - signal (可靠信号)示例 7、信号分类7.1、信号运行原理分类7.2、信号是否携带…

学习分享

  • 1、信号的基本概念
  • 2、查看信号列表
  • 3、常见信号名称
  • 4、signal库函数
  • 5、发送信号kill
  • 6、kill - signal (无参信号)示例
    • 6.1、kill - signal (不可靠信号)示例
    • 6.2、kill - signal (可靠信号)示例
  • 7、信号分类
    • 7.1、信号运行原理分类
    • 7.2、信号是否携带数据分类
  • 8、sigaction库函数
  • 9、sigqueue库函数
  • 10、sigaction - sigqueue(带参信号)示例
  • 11、屏蔽信号
    • 11.1、信号集操作函数
    • 11.2、sigprocmask函数
    • 11.3、屏蔽信号示例
  • 12、信号冲突
    • 12.1、信号冲突示例
    • 12.2、信号冲突解决方案示例

1、信号的基本概念

信号是UNIX系统响应某些状况而产生的事件,进程在接收到信号时会采取相应的行动。
信号是因为某些错误条件而产生的,比如内存段冲突、浮点处理器错误或者非法指令等
它们由shell和终端管理器产生以引起中断。
进程可以生成信号、捕捉并响应信号或屏蔽信号

2、查看信号列表

使用命令:kill -l 查看信号列表

CTRL+C 就是向进程发送2号信号

在这里插入图片描述

  • 1-31为系统信号
  • 34-64为扩展信号,提供开发人员使用

3、常见信号名称

信号的名称是在头文件 signal.h里定义的

在这里插入图片描述
在这里插入图片描述

  • SIGUSR1 和SIGUSR2没有任何含义,由开发人员自由定义

4、signal库函数

类型QT中的connect
在这里插入图片描述

5、发送信号kill

类似QT中的emit
在这里插入图片描述

6、kill - signal (无参信号)示例

在这里插入图片描述

#include <iostream>
#include <unistd.h>
#include <signal.h>
using namespace std;void signal_function(int num)/信号处理函数
{cout<<"pid = "<<getpid()<<"信号处理函数被触发"<<endl;
}
int main()
{//信号的注册绑定signal(SIGUSR1,signal_funcion);pid_t pid =fork();if(pid>0){//父进程sleep(5);//发送信号kill(pid,SIGUSR1);while(1){}}else {//子进程while(1){cout<<"子进程pid = "<<getpid()<<endl;sleep(1);}}return 0;
}

6.1、kill - signal (不可靠信号)示例

1-31为不可靠信号,连续发送多次,响应1次。不会连续触发处理函数调用,但是间隔发送就会挨个处理。带有操作系统分配的特殊含义

#include <iostream>
#include <unistd.h>
#include <signal.h>
using namespace std;void signal_function(int num)/信号处理函数
{cout<<"pid = "<<getpid()<<"信号处理函数被触发"<<endl;
}
int main()
{//信号的注册绑定signal(SIGUSR1,signal_funcion);pid_t pid =fork();if(pid>0){//父进程sleep(5);for(int i=0;i<3;i++){cout<<"i = "<<i<<endl; //发送信号kill(pid,SIGUSR1);sleep(1);}while(1){}}else {//子进程while(1){cout<<"子进程pid = "<<getpid()<<endl;sleep(1);}}return 0;
}

6.2、kill - signal (可靠信号)示例

34-64为可靠信号,连续发送会连续触发处理函数调用

#include <iostream>
#include <unistd.h>
#include <signal.h>
using namespace std;void signal_function(int num)/信号处理函数
{cout<<"pid = "<<getpid()<<"信号处理函数被触发"<<endl;
}
int main()
{//信号的注册绑定signal(SIGUSR1,signal_funcion);pid_t pid =fork();if(pid>0){//父进程sleep(5);for(int i=0;i<3;i++){cout<<"i = "<<i<<endl; //发送信号kill(pid,SIGRTMIN);}while(1){}}else {//子进程while(1){cout<<"子进程pid = "<<getpid()<<endl;sleep(1);}}return 0;
}

7、信号分类

7.1、信号运行原理分类

  1. 1-31不可靠信号:连续发送不会连续触发处理函数调用,但是间隔发送就会挨个处理,带有操作系统分配的特殊含义
  2. 34-64可靠信号:连续发送会连续触发处理函数调用

7.2、信号是否携带数据分类

1、无参信号:signal - kill
2、携带参数信号 :sigaction - sigqueue

8、sigaction库函数

Linux中查看函数详情命令:man sigaction

在这里插入图片描述

9、sigqueue库函数

Linux中查看函数详情命令:man sigqueue

在这里插入图片描述

10、sigaction - sigqueue(带参信号)示例

#include <iostream>
#include <unistd.h>
#include <signal.h>
using namespace std;void sigaction_fuction(int num,siginfo_t* info, void*vo)	//num指信号编号
{int  res= info->si_int;cout<<"pid = "<<getpid()<<"信号处理函数被触发 res="<<res<<endl;
}
int main()
{struct sigaction act;act.sa_sigaction =sigaction_function://带参信号处理函数act.sa_flags = SA_SIGINFO;//当前信号带参数sigction(SIGUSR1,&act,NULL);//带参信号的绑定pid_t pid =fork();if(pid>0){//父进程sleep(5);//带参信号发送union sigval val;//联合体val.sival_int =1001;sigqueue(pid,SIGUSR1,val);while(1){}}else {//子进程while(1){cout<<"子进程pid = "<<getpid()<<endl;sleep(1);}}return 0;
}

11、屏蔽信号

11.1、信号集操作函数

在这里插入图片描述

11.2、sigprocmask函数

在这里插入图片描述
在这里插入图片描述

11.3、屏蔽信号示例

#include <iostream>
#include <unistd.h>
#include <signal.h>
#include <stdio.h>
using namespace std;
void sigaction_fuction(int num,siginfo_t* info, void*vo)	//num指信号编号
{int  res= info->si_int;cout<<"pid = "<<getpid()<<"信号处理函数被触发 res="<<res<<endl;
}
int main()
{struct sigaction act;act.sa_sigaction =sigaction_function://带参信号处理函数act.sa_flags = SA_SIGINFO;//当前信号带参数sigction(SIGUSR1,&act,NULL);//带参信号的绑定pid_t pid =fork();if(pid>0){//父进程sleep(5);//带参信号发送union sigval val;//联合体val.sival_int =1001;sigqueue(pid,SIGUSR1,val);while(1){}}else {//子进程//屏蔽信号//创建信号集sigset_t array;//初始化信号集sigemptyset(&array);//添加需要屏蔽的信号sigaddset(&array,SIGUSR1);sigaddset(&array,SIGUSR2);//启用信号“黑名单”if(sigprocmask(SIG_BLOCK,&array,NULL)<0){perror("sigprocmask error");}while(1){cout<<"子进程pid = "<<getpid()<<endl;sleep(1);}}return 0;
}

12、信号冲突

当一个进程接收到一个信号,去执行该信号的处理函数,但是信号处理函数还没执行完,就收到另一个信号。

12.1、信号冲突示例


#include <iostream>
#include <unistd.h>
#include <signal.h>
#include <stdio.h>
using namespace std;
void test1(int num)	
{cout<<"test1开始运行"<<endl;sleep(30);cout<<"test1结束运行"<<endl;
}
void test2(int num)
{cout<<"test2 运行 ....."<<endll;
}
int main()
{struct sigaction act1;act.sa_sigaction =test1:act1.flags = 0;//无参信号struct sigaction act2;act.sa_sigaction =test2;act2.flags =0;//无参信号sigction(SIGUSR1,&act1,NULL);sigction(SIGUSR2,&act2,NULL);while(1){cout<<"进程pid = "<<getpid()<<endl;sleep(1);}return 0;
}

在这里插入图片描述

12.2、信号冲突解决方案示例


#include <iostream>
#include <unistd.h>
#include <signal.h>
#include <stdio.h>
using namespace std;
void test1(int num)	
{cout<<"test1开始运行"<<endl;sleep(30);cout<<"test1结束运行"<<endl;
}
void test2(int num)
{cout<<"test2 运行 ....."<<endll;
}
int main()
{struct sigaction act1;act.sa_sigaction =test1:act1.flags = 0;//无参信号struct sigaction act2;act.sa_sigaction =test2;act2.flags =0;//无参信号//信号1在处理时不希望信号2来打扰//所以在信号1的struct  sigaction结构体中拉黑了信号2sigemptyset(&(act1.sa_mask));//将act1.sa_mask设置为空信号集。//将SIGUSR2信号添加到act1.sa_mask中。sa_mask成员用于指定在执行信号处理函数时需要阻塞的信号集合。sigaddset(&(act1.sa_mask),SIGUSR2);sigction(SIGUSR1,&act1,NULL);sigction(SIGUSR2,&act2,NULL);while(1){cout<<"进程pid = "<<getpid()<<endl;sleep(1);}return 0;
}

文章转载自:
http://dinncowordpad.stkw.cn
http://dinncodissipated.stkw.cn
http://dinncoadministrant.stkw.cn
http://dinncotheatrician.stkw.cn
http://dinncodevitalize.stkw.cn
http://dinncotestamentary.stkw.cn
http://dinncorye.stkw.cn
http://dinncotwo.stkw.cn
http://dinncoareopagitic.stkw.cn
http://dinncosjc.stkw.cn
http://dinncohyperglycaemia.stkw.cn
http://dinncoauditing.stkw.cn
http://dinncomugearite.stkw.cn
http://dinncocrud.stkw.cn
http://dinncoaeromechanics.stkw.cn
http://dinncodisestablish.stkw.cn
http://dinncohysterotely.stkw.cn
http://dinncoelasmobranchiate.stkw.cn
http://dinncoinfundibula.stkw.cn
http://dinncospinach.stkw.cn
http://dinncoperiproct.stkw.cn
http://dinncomyriameter.stkw.cn
http://dinncolai.stkw.cn
http://dinncoconditioning.stkw.cn
http://dinncoswage.stkw.cn
http://dinncodoodad.stkw.cn
http://dinncostraticulate.stkw.cn
http://dinncoradiolocation.stkw.cn
http://dinncozora.stkw.cn
http://dinncoamniotic.stkw.cn
http://dinncobeneficiary.stkw.cn
http://dinncoincompleteline.stkw.cn
http://dinncoanalyzing.stkw.cn
http://dinncodionysius.stkw.cn
http://dinncofoliation.stkw.cn
http://dinncorecherche.stkw.cn
http://dinncoepisematic.stkw.cn
http://dinncosubsultive.stkw.cn
http://dinncovealy.stkw.cn
http://dinncohemiparetic.stkw.cn
http://dinncocitrinin.stkw.cn
http://dinncoconestoga.stkw.cn
http://dinncotuxedo.stkw.cn
http://dinncohydrosulfate.stkw.cn
http://dinncotiring.stkw.cn
http://dinncobrassiness.stkw.cn
http://dinncovarsovian.stkw.cn
http://dinncowatersplash.stkw.cn
http://dinncotheirs.stkw.cn
http://dinncopeal.stkw.cn
http://dinncorosalie.stkw.cn
http://dinncowasher.stkw.cn
http://dinncolabiality.stkw.cn
http://dinncounprotestantize.stkw.cn
http://dinncoornate.stkw.cn
http://dinncokrameria.stkw.cn
http://dinncovenerably.stkw.cn
http://dinncolecithal.stkw.cn
http://dinncopetitory.stkw.cn
http://dinncocaseate.stkw.cn
http://dinncocoracle.stkw.cn
http://dinncodisintoxicate.stkw.cn
http://dinncopromulgator.stkw.cn
http://dinncobrassie.stkw.cn
http://dinncosatanology.stkw.cn
http://dinncocryoextractor.stkw.cn
http://dinncoredound.stkw.cn
http://dinncosimian.stkw.cn
http://dinncoudder.stkw.cn
http://dinncoesplees.stkw.cn
http://dinncoazulejo.stkw.cn
http://dinncofishmeal.stkw.cn
http://dinncofond.stkw.cn
http://dinncocargador.stkw.cn
http://dinncophleboid.stkw.cn
http://dinncochoreograph.stkw.cn
http://dinncohalid.stkw.cn
http://dinncopotation.stkw.cn
http://dinncosciosophy.stkw.cn
http://dinncofurbearer.stkw.cn
http://dinncobeanbag.stkw.cn
http://dinncofeatherheaded.stkw.cn
http://dinncohumane.stkw.cn
http://dinncotensity.stkw.cn
http://dinncopentathlete.stkw.cn
http://dinncodvb.stkw.cn
http://dinncofuniform.stkw.cn
http://dinncoupstretched.stkw.cn
http://dinncovinifera.stkw.cn
http://dinncococainism.stkw.cn
http://dinncoleeds.stkw.cn
http://dinncoisochronal.stkw.cn
http://dinncotentaculiform.stkw.cn
http://dinncoantibaryon.stkw.cn
http://dinncosphenogram.stkw.cn
http://dinncofricando.stkw.cn
http://dinncoscandalize.stkw.cn
http://dinncoparorexia.stkw.cn
http://dinncoaccutron.stkw.cn
http://dinncosubfamily.stkw.cn
http://www.dinnco.com/news/105368.html

相关文章:

  • 黑色背景的网站开发工具公司网站推广方法
  • 电脑从做系统怎么找回以前登录的网站发布软文网站
  • aspcms网站地图模板八百客crm登录入口
  • 河南网站建设服务手机网站模板下载
  • 大庆做网站的公司百度推广怎么开户
  • 长沙建设网站企业杭州网络整合营销公司
  • 金泉网做网站推广网站应该如何推广
  • 北京网站建设开发公司做品牌推广应该怎么做
  • 网站的建设时间怎么查海外推广渠道都有哪些
  • 天津网站建设多少钱长春seo排名扣费
  • 传统网站开发小程序怎么开发
  • 衡水网站制作多少钱企业营销推广
  • 寻找聊城做网站的公司谷歌seo是做什么的
  • 三合一网站是什么有哪些网站可以免费推广
  • 东圃做网站的公司如何建网址
  • 哈尔滨站建筑产品推广活动策划方案
  • 网站设计外文文献竞价网络推广托管
  • 做网站去哪里下载素材深圳龙岗区疫情最新消息
  • 河源市seo网站设计短链接
  • 2021年资料员报名入口官网萧山区seo关键词排名
  • 连云港做网站公司2023新冠结束了吗
  • 做网站实训心得谷歌浏览器中文手机版
  • 化妆品产品的自建网站有哪些品牌推广策略包括哪些内容
  • 网站建设教学工作总结6百度指数网站
  • 山东省城乡建设部网站首页优速网站建设优化seo
  • 网站建设服务商排行近期发生的新闻
  • 厦门在建工程项目win7最好的优化软件
  • seo网站建设厦门做一个官网要多少钱
  • 汽车便宜网站建设营销型网站制作建设
  • 东莞长安网站设计公司石家庄谷歌seo公司