Kqueue & epoll control events

Source: Internet
Author: User
Tags epoll

Both kqueue and epoll have read, write, and error events.

In the process of using both, it is found that the kqueue has reasonable control over the event, and epoll needs to carefully read the document and practice to know what is going on.

 

1. enable one event

Epoll activates an event through epoll_ctl_mod. Note that there is a read event in epoll, and only the write event is passed during mod. This is the time when only the write event is in epoll, the read event does not exist.

Kqueue can activate an event through ev_enable without affecting registered events.

 

2. Disable 1 event

Epoll:

Re-epoll_ctl_mod to remove the events to be disabled,

Events = registeredevents &(~ Disableevents)

Did I make a mistake? This is a strange practice.

 

Kqueue uses ev_disable to easily disable an event.

 

3. delete an event

Epoll uses epoll_ctl_del. Whether the events are uploaded or not, epoll deletes all events internally!

Kqueue has an ev_delete option that can be used to delete an event.

 

For details about kqueue, refer:

Http://www.ibm.com/developerworks/cn/aix/library/1105_huangrg_kqueue/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.