I think these are the two eve开发者_如何学JAVAnt-dealing libraries among the best.
These two both have many users,but which is better?
epoll is offered by Linux. libevent is built on top of epoll. Using epoll alone may thus be more efficient, if you know what you're doing.
As mentioned by blais
, libevent uses epoll internally. Libev (http://software.schmorp.de/pkg/libev.html) is also a good choice (I feel it is better than libevent, but that is just me). As for me, I've used epoll directly in some projects and libev in other projects. I like libev because it also provides timers, signals, periodic timers (cron-like), and stat watchers.
So, which is better? If you want to watch a few socket descriptors then epoll is probably all you need. If you are writing a multi-threaded application then libevent/libev would probably be a better way to go. I don't think you'll see an appreciable speed difference between epoll and libevent/libev.
精彩评论