event_add
2016-09-23 17:11:33 1 举报
AI智能生成
libevent
作者其他创作
大纲/内容
event_add_internal(ev, tv, 0);
if(tv != NULL && !(ev->ev_flags & EVLIST_TIMEOUT))
min_heap_reserve(&base->timeheap,1 + min_heap_size(&base->timeheap)
if (ev->ev_events & (EV_READ|EV_WRITE))
evmap_io_add(base, ev->ev_fd, ev)
初始化或获取struct evmap_io *ctx
设置old(events)
设置res(events)
epoll_nochangelist_add
(base, ev->ev_fd, old, (ev->ev_events & EV_ET) | res, extra)
设置struct event_change ch
ch.fd = fd;
ch.old_events = old;
ch.read_change = ch.write_change = 0;
根据events设置ch.write_change/read_change
epoll_apply_one_change(base, base->evbase, &ch)
events = EPOLLIN | EPOLLOUT | EPOLLET
op = EPOLL_CTL_ADD | EPOLL_CTL_MOD
epev.data.fd = ch->fd;
epev.events = events;
epoll_ctl(epollop->epfd, op, ch->fd, &epev)
if (ev->ev_events & EV_SIGNAL)
evmap_signal_add(base, (int)ev->ev_fd, ev)
0 条评论
下一页