Learning redis source code [epoll encapsulation]

Source: Internet
Author: User
Tags epoll
Introduction

In the previous blog, we mentioned that the underlying Linux epoll is used in redis event processing, and other multi-channel communication layers can be used according to the implementation of redis, however, epoll is the most commonly used in Linux servers. Redis does not directly use Linux epoll but encapsulates it.

Source code

AE _epoll.c

Analysis

It is encapsulated on the basis of the original Linux epoll and mainly encapsulates several functions:

Aeapicreate: Call epoll_create to create the epoll handle and assign the epoll event.

Aeapifree: call close to close the epoll handle created by epoll_create and release the epoll event.

Aeapiaddevent: Call epoll_ctl to add an event to aeeventloop.

Aeapidelevent: Call epoll_ctl to delete an event from aeeventloop.
Aeapipoll: calls the epoll_wait wait event.

For more information about epoll, see blog: Click to open the link.

Related Article

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.