问题描述
我是IM pression的提高:: ASIO将使用默认而不是选择一个执行epoll的设置下,但在运行一些测试,它看起来像我的设置是使用select后。
I was under the impression that boost::asio would use an epoll setup by default instead of a select implementation, but after running some tests it looks like my setup is using select.
OS:RHEL 4结果
内核:2.6结果
GCC:3.4.6
OS: RHEL 4
Kernel:2.6
GCC:3.4.6
我写了一个小的测试程序来验证正在使用的反应堆头,而且它就像使用选择器,而不是反应堆epoll的它的外观。
I wrote a little test program to verify which reactor header was being used, and it looks like its using the select reactor rather than the epoll reactor.
#include <boost/asio.hpp>
#include <string>
#include <iostream>
std::string output;
#if defined(BOOST_ASIO_EPOLL_REACTOR_HPP)
int main(void)
{
std::cout << "you have epoll enabled." << std::endl;
}
#elif defined(BOOST_ASIO_DETAIL_SELECT_REACTOR_HPP)
int main(void)
{
std::cout << "you have select enabled." << std::endl;
}
#else
int main(void)
{
std::cout << "this shit is confusing." << std::endl;
}
#endif
还有什么我做错了?
What could I be doing wrong?
推荐答案
您说的程序,选择对我来说,没有ASIO用epoll_wait(),如 PS -Teo TID,WCHAN:25 ,通讯
报告。
Your program says "select" for me too, yet asio is using epoll_wait(), as ps -Teo tid,wchan:25,comm
reports.
关于
#include <iostream>
#include <string>
#include <boost/asio.hpp>
int main()
{
std::string output;
#if defined(BOOST_ASIO_HAS_IOCP)
output = "iocp" ;
#elif defined(BOOST_ASIO_HAS_EPOLL)
output = "epoll" ;
#elif defined(BOOST_ASIO_HAS_KQUEUE)
output = "kqueue" ;
#elif defined(BOOST_ASIO_HAS_DEV_POLL)
output = "/dev/poll" ;
#else
output = "select" ;
#endif
std::cout << output << std::endl;
}
(的ifdef的梯子,从抢到 /usr/include/boost/asio/serial_port_service.hpp
)
这篇关于升压短耳在Linux上不使用是Epoll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!