Ace supports epoll Compilation

Source: Internet
Author: User
Ace support epoll
 
Use epoll [Zhuan] in Ace to add to favorites. Obviously,ArticleThe title determines that Ace is used in Linux. We know that ace uses select to implement Reactor by default in Linux. The advantages of epoll over select are not described here. Let's talk about the operation steps directly:
First, recompile the ace library to support epoll through the ace_dev_poll_reactor class. However, the default installation of the ACE library does not compile this class, what we need to do is to connect ace_dev_poll_reactor compilation to the ace Library (faint, re-compile ace, it takes more than an hour to compile it on my broken server ). my operating system is RedHat Linux as4.0, And the ace version is 5.4.10. The ace-install.html in the abstracecompressed package is installed using the "Building ace with GNU Autoconf" method. The installation steps are as follows (very simple as they are not translated): 1 CD to the top-level ace_wrappers directory. 2. create a subdirectory to hold your build's configuration and built ace version, and then change to the new directory: mkdir build CD build 3. note that you do not run the create_ace_build.pl utility mentioned in the cloning the source tree section. the Configure s Takes care of creating all files and links that are needed. configure Ace for your platform by issuing the following command: C .. /configure [Options] 4. build ace by typing make. 5. install ace by typing make install. now we can finally explain how to compile ace_dev_poll_reactor into the ace library. Modify ace_wrappers/ACE/config-linux.h between Step 1 and step 2, add a line: # define ace_has_event_poll, and then perform steps 2nd, 3, 3rd .. /After configure is executed, some files and directories are generated under the build directory. Open ace_wrappers/build/ACE/config. h, add a row: # define ace_has_event_poll. Then, execute steps 4th make and 5th make install. OK. After a long compilation, the ace library that supports epoll is finally completed.
 2: modifying the application  Program  is simple, two lines of  Code  are used to initialize an application (must be added between ace_reactor: instance () for the first time: m_pdevpollreactor = new operator; ace_reactor: instance (New ace_reactor (m_pdevpollreactor); then, in the future, the implementation of ace_reactor: instance () is implemented using callback. Third: Re-compile the application and add-dace_has_event_poll To The makefile of the application, and re-make the application. OK. 
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.