|
Boost Users : |
Subject: [Boost-users] boost::asio::io_service::poll_once vs EPOLLET
From: Jason Aubrey (jason_at_[hidden])
Date: 2014-03-11 12:19:44
The conditional define of boost::asio::io_service that uses epoll always seems to use edge triggered (ET) flag instead of level triggered (LT).
This makes me think poll_once should be avoided due to Scenario 1 below.
Can anyone confirm this?
Given:
1) 2 sockets (A and B) added to epoll interface for receiving only
2) 2 UDP messages arrive in the same moment on socket A
3) epoll_wait returns a ready socket (socket A)
Scenario 1: Using ET with poll_once:
4) If io_service::poll_once is called 1 of 2 messages are read
5) epoll_wait(ET) blocks until another message is received
Result: Bad, starvation if another message is not received
Scenario 2: Using ET with poll:
4) If io_service::poll is called 2 of 2 messages are read
5) epoll_wait(ET) blocks until another message is received?
Result: Good, all messages processed without A/B fairness (unfair since read was greedy)
Scenario 3: Using LT with poll_once:
4) If io_service::poll_once is called 1 of 2 messages are read
5) epoll_wait(LT) returns a ready socket (socket A)
6) If io_service::poll_once is called 1 of 1 messages are read
Result: Good, all messages processed with A/B fairness
I don't think Scenario 3 is currently supported by boost::asio::io_service.
Jason
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net