base = event_base_new_with_config(cfg);event_config_free(cfg);if(base)break;/* If we get here, event_base_new_with_config() returned NULL. Ifthis is the first time around the loop, we'll try again withoutsetting EV_FEATURE_ET. If this is the second time around theloop, we'll ...
event_base_loopexit:如果tv参数不为空,则让event_base在给定时间之后停止循环。如果tv参数为NULL,event_base会立即停止循环,没有延时。如果event_base当前正在执行任何激活事件的回调,则回调会继续运行,直到运行完所有激活事件的回调之才退出。 event_base_loopbreak:event_base立即退出循环。它与event_base_loopexit(b...
event_base_loopexit → 代码语言:txt 复制 © 1997–2017 The PHP Documentation Group Licensed under the Creative Commons Attribution License v3.0 or later. https://secure.php.net/manual/en/function.event-base-loopbreak.php 本文档系腾讯云开发者社区成员共同维护,如有问题请联系cloudcommunity@tencent....
event_base_loopbreak()与event_base_loopexit(base, NULL)的行为有一些区别, 如果有激活时间在运行,event_base_loopbreak()会等待第一个完成后直接退出,而不是等待所有的完成后再退出。 当没有事件循环在跑时,调用这两个API行为也不一样,loopexit会在下一个event loop开始新一轮回调的时候停止(即使传入了EVLOO...
int event_base_loopexit(struct event_base *base, const struct timeval *tv);int event_base_loopbreak(struct event_base *base);struct timeval {long tv_sec;long tv_usec;}; 两个函数的区别是如果正在执行激活事件的回调函数, 那么event_base_loopexit将在事件回调执行结束后终止循环(如果tv时间非NULL, ...
//是否执行完活动时间队列上的剩余任务之后就退出事件循环 int event_gotterm; //不管是否还有剩余事件,强制退出事件循环 int event_break; //是否应该启动一个新的事件循环 int event_continue; //目前处理的活动事件队列的优先级 int event_running_priority; //循环是否已启动 int running_loop; /** Set to...
EVENT_BASE_FLAG_NO_CACHE_TIME:不检查timeout,代之以为每个event loop都准备调用timeout方法。这会导致CPU使用率偏高 EVENT_BASE_FLAG_EPOLL_USE_CHANGELIST:告诉libevent如果使用epoll的话,可以使用基于“changlist”的backend。 EVENT_BASE_FLAG_PRECISE_TIMER:使用更加精确的定时机制 ...
intevent_base_loop(structevent_base*base,intflags){//设置为EVLOOP_NONBLOCK,那么event_loop只会处理当前已经激活的event,处理结束后就会退出event_loop//设置为EVLOOP_ONCE,那么event_loop就会等待到第一个事件超时,处理在这段时间内激活的event,直到所有激活的事件都处理完就退出event_loop//设置为其他值,那么...
* 运行到调用event_base_loopbreak或者event_base_loopexit函数。你可以使用’flags‘调整loop行为。 * 参数 eb:event_base_new或者event_base_new_with_config产生的event_base结构体 * flags:可以是EVLOOP_ONCE|EVLOOP_NONBLOCK * 返回值:成功则为0,失败则为-1,如果因为没有等待的事件或者激活事件而退出则返回...