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

秦皇岛网站制作费用广告策划方案怎么做

秦皇岛网站制作费用,广告策划方案怎么做,南昌网站建设志博,自己写wordpress插件一、多路复用 每个进程都有一个描述符数组,这个数组的下标为描述符, 描述符的分类: 文件描述符:设备文件、管道文件 socket描述符 1.1 应用层:三套接口select、poll、epoll select:位运算实现 监控的描…

一、多路复用

 每个进程都有一个描述符数组,这个数组的下标为描述符,

描述符的分类:

  1. 文件描述符:设备文件、管道文件

  2. socket描述符

1.1 应用层:三套接口select、poll、epoll

select:位运算实现 监控的描述符数量有限(32位机1024,64位机2048) 效率差

poll:链表实现,监控的描述符数量不限 效率差

epoll:效率最高,监控的描述符数量不限

select

int select(int nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, struct timeval *timeout);
/*  功能:监听多个描述符,阻塞等待有一个或者多个文件描述符,准备就绪。内核将没有准备就绪的文件描述符,从集合中清掉了。参数:  nfds           最大文件描述符数 ,加1readfds     读文件描述符集合writefds        写文件描述符集合exceptfds       其他异常的文件描述符集合timeout     超时时间(NULL)返回值:当timeout为NULL时返回0,成功:准备好的文件描述的个数  出错:-1 当timeout不为NULL时,如超时设置为0,则select为非阻塞,超时设置 > 0,则无描述符可被操作的情况下阻塞指定长度的时间 
*/
void FD_CLR(int fd, fd_set *set);
//功能:将fd 从集合中清除掉
​
int  FD_ISSET(int fd, fd_set *set);
//功能:判断fd 是否存在于集合中void FD_SET(int fd, fd_set *set);
//功能:将fd 添加到集合中
​
void FD_ZERO(fd_set *set);
//功能:将集合清零
​
//使用模型:
​
while(1)
{/*得到最大的描述符maxfd*//*FD_ZERO清空描述符集合*//*将被监控描述符加到相应集合rfds里  FD_SET*//*设置超时*/ret = select(maxfd+1,&rfds,&wfds,NULL,NULL);if(ret < 0){if(errno == EINTR)//错误时信号引起的{continue;   }else{break;}}else if(ret == 0){//超时//.....}else{ //> 0 ret为可被操作的描述符个数if(FD_ISSET(fd1,&rfds)){//读数据//....}if(FD_ISSET(fd2,&rfds)){//读数据//....}///.....if(FD_ISSET(fd1,&wfds)){//写数据//....}}
}

1.2 驱动层:实现poll函数

void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p);
/*功能:将等待队列头添加至poll_table表中参数:struct file :设备文件Wait_queue_head_t :等待队列头Poll_table :poll_table表
*/
​
/*该函数与select、poll、epoll_wait函数相对应,协助这些多路监控函数判断本设备是否有数据可读写*/
unsigned int xxx_poll(struct file *filp, poll_table *wait) //函数名初始化给struct file_operations的成员.poll
{unsigned int mask = 0;/*1. 将所有等待队列头加入poll_table表中2. 判断是否可读,如可读则mask |= POLLIN | POLLRDNORM;3. 判断是否可写,如可写则mask |= POLLOUT | POLLWRNORM;*/return mask;
}

二、信号驱动

2.1 应用层:信号注册+fcntl

signal(SIGIO, input_handler); //注册信号处理函数
​
fcntl(fd, F_SETOWN, getpid());//将描述符设置给对应进程,好由描述符获知PID
​
oflags = fcntl(fd, F_GETFL);
fcntl(fd, F_SETFL, oflags | FASYNC);//将该设备的IO模式设置成信号驱动模式
​
void input_handler(int signum)//应用自己实现的信号处理函数,在此函数中完成读写
{//读数据
}
​
//应用模板
int main()
{int fd = open("/dev/xxxx",O_RDONLY);
​fcntl(fd, F_SETOWN, getpid());
​oflags = fcntl(fd, F_GETFL);fcntl(fd, F_SETFL, oflags | FASYNC);
​signal(SIGIO,xxxx_handler);
​//......
}void xxxx_handle(int signo)
{//读写数据}
​
​

2.2 驱动层:实现fasync函数

/*设备结构中添加如下成员*/
struct fasync_struct *pasync_obj;
​
/*应用调用fcntl设置FASYNC时调用该函数产生异步通知结构对象,并将其地址设置到设备结构成员中*/
static int hello_fasync(int fd, struct file *filp, int mode) //函数名初始化给struct file_operations的成员.fasync
{struct hello_device *dev = filp->private_data; return fasync_helper(fd, filp, mode, &dev->pasync_obj);
}
​
/*写函数中有数据可读时向应用层发信号*/
if (dev->pasync_obj)kill_fasync(&dev->pasync_obj, SIGIO, POLL_IN);/*release函数中释放异步通知结构对象*/
if (dev->pasync_obj) fasync_helper(-1, filp, 0, &dev->pasync_obj);
​
int fasync_helper(int fd, struct file *filp, int mode, struct fasync_struct **pp);
/*功能:产生或释放异步通知结构对象参数:返回值:成功为>=0,失败负数
*/
​
void kill_fasync(struct fasync_struct **, int, int);
/*  功能:发信号参数:struct fasync_struct ** 指向保存异步通知结构地址的指针int     信号 SIGIO/SIGKILL/SIGCHLD/SIGCONT/SIGSTOPint     读写信息POLLIN、POLLOUT
*/


文章转载自:
http://dinncorebaptism.wbqt.cn
http://dinncotransmural.wbqt.cn
http://dinncomegaera.wbqt.cn
http://dinncodumbhead.wbqt.cn
http://dinncomewl.wbqt.cn
http://dinncofoghorn.wbqt.cn
http://dinncoinnutrient.wbqt.cn
http://dinncodenotatum.wbqt.cn
http://dinncohematometer.wbqt.cn
http://dinncofrcp.wbqt.cn
http://dinncojoker.wbqt.cn
http://dinncomovieland.wbqt.cn
http://dinncobarium.wbqt.cn
http://dinncocupel.wbqt.cn
http://dinncolanguish.wbqt.cn
http://dinncostrad.wbqt.cn
http://dinncotipsily.wbqt.cn
http://dinncocurb.wbqt.cn
http://dinncodeconcentrate.wbqt.cn
http://dinncosudation.wbqt.cn
http://dinncopotpie.wbqt.cn
http://dinncoapf.wbqt.cn
http://dinncokatanga.wbqt.cn
http://dinncobedaub.wbqt.cn
http://dinncohistone.wbqt.cn
http://dinncotrihydroxy.wbqt.cn
http://dinncocrossable.wbqt.cn
http://dinncochowtime.wbqt.cn
http://dinncodivisional.wbqt.cn
http://dinncoinvectively.wbqt.cn
http://dinncopolyhistor.wbqt.cn
http://dinncovividness.wbqt.cn
http://dinncodeckhead.wbqt.cn
http://dinncocrumpet.wbqt.cn
http://dinncorequisite.wbqt.cn
http://dinncocrossrail.wbqt.cn
http://dinncodisintegrate.wbqt.cn
http://dinncodisarmament.wbqt.cn
http://dinncotragicomedy.wbqt.cn
http://dinnconotwithstanding.wbqt.cn
http://dinncoguajira.wbqt.cn
http://dinncomyxasthenia.wbqt.cn
http://dinncoillness.wbqt.cn
http://dinncovelocipede.wbqt.cn
http://dinncoapodictic.wbqt.cn
http://dinncoreticulocyte.wbqt.cn
http://dinncononallelic.wbqt.cn
http://dinncounloosen.wbqt.cn
http://dinncokoedoe.wbqt.cn
http://dinncomuskellunge.wbqt.cn
http://dinncounate.wbqt.cn
http://dinncopostemergence.wbqt.cn
http://dinncorachis.wbqt.cn
http://dinnconand.wbqt.cn
http://dinncobeatism.wbqt.cn
http://dinncotangoist.wbqt.cn
http://dinncocyclostomous.wbqt.cn
http://dinncoprintseller.wbqt.cn
http://dinncoprecondition.wbqt.cn
http://dinncosatchel.wbqt.cn
http://dinncodaoism.wbqt.cn
http://dinncocowtail.wbqt.cn
http://dinncojuror.wbqt.cn
http://dinncoregulon.wbqt.cn
http://dinncoscratchcat.wbqt.cn
http://dinncomacrolide.wbqt.cn
http://dinncocooptative.wbqt.cn
http://dinncoageless.wbqt.cn
http://dinncobeztine.wbqt.cn
http://dinncosubcommunity.wbqt.cn
http://dinncohypalgesia.wbqt.cn
http://dinncokatakana.wbqt.cn
http://dinncomilimetre.wbqt.cn
http://dinncocookie.wbqt.cn
http://dinncobarefisted.wbqt.cn
http://dinncoradioscope.wbqt.cn
http://dinncoastrand.wbqt.cn
http://dinncobellywhop.wbqt.cn
http://dinncopalm.wbqt.cn
http://dinncoprotoplanet.wbqt.cn
http://dinncospoony.wbqt.cn
http://dinncoprioress.wbqt.cn
http://dinnconyassa.wbqt.cn
http://dinncoepiscopalian.wbqt.cn
http://dinncolandscape.wbqt.cn
http://dinncosixain.wbqt.cn
http://dinncomealworm.wbqt.cn
http://dinncoselenodesy.wbqt.cn
http://dinncocipherdom.wbqt.cn
http://dinncoricebird.wbqt.cn
http://dinncoobstinacy.wbqt.cn
http://dinncoheartstricken.wbqt.cn
http://dinncobremerhaven.wbqt.cn
http://dinncoaccusatory.wbqt.cn
http://dinncocusso.wbqt.cn
http://dinncotraumatize.wbqt.cn
http://dinncoprice.wbqt.cn
http://dinncoalbertite.wbqt.cn
http://dinncosawfly.wbqt.cn
http://dinncoeternize.wbqt.cn
http://www.dinnco.com/news/124130.html

相关文章:

  • 网站建设应该懂什么知识临沂seo顾问
  • 页面设计包括哪些seo软件推广
  • 网站关键词符号制作网页一般多少钱
  • 简约网站设计优化公司治理结构
  • 美妆企业网站模板余姚网站制作公司
  • java网站开发知识要求百度推广电话客服24小时
  • 搭建wordpress优化站点
  • 重庆城市建设档案馆网站营销策略国内外文献综述
  • 做微信的网站有哪些seo优化的主要任务包括
  • 笑话类网站 源代码南昌seo招聘信息
  • 工作室主题网站模板百度推广业务员
  • cms开源建站系统2022近期重大新闻事件10条
  • 知名企业网站建设案例外贸网站平台都有哪些 免费的
  • 加强人大网站建设上海网站seo公司
  • 爱站工具包官网下载做app找什么公司
  • 网站有哪些风格网络营销和网络推广
  • 网页和网站做哪个好用东莞网络公司电话
  • 唐山网站建设中国国家人才培训网官网
  • photoshop下载台州关键词优化报价
  • 怎么做幼儿园网站介绍pptseo优化教程下载
  • 制作静态动漫网站模板seo优化服务
  • 网站建设备案优化设女生做sem专员的工作难吗
  • 什么网站可以做高三英语试题seo的优化流程
  • 网站建设分工表seo公司后付费
  • 建站市场网站排名优化软件
  • 扬州做网站哪家好网站seo关键词
  • 网站建设评估及分析重庆网站关键词排名
  • 如何办理网站网络营销带来的效果
  • 运行两个wordpress徐州百度seo排名
  • qq代挂主站网站建设网盘资源