Comments (7)
EPOLLPRI
is enable by default when using readable interest.
from mio.
EPOLLPRI is enable by default when using readable interest.
Really? I don't see this backed by the code and I do not get any EPOLLPRI
events from the kernel.
Have a look here:
mio/src/sys/unix/selector/epoll.rs
Lines 170 to 182 in 1f8cd97
This sets the event type flags up for the syscall. And it does not set
EPOLLPRI
.
I made a "horrible hack" here: poeschel@538970c
With this change I do receive the EPOLLPRI
events.
from mio.
EPOLLPRI
is an output flags only if I recall correctly, so you should see it when use register readable interest. If you want to test this for yourself you can send some Out-Of-Bound (MSG_OOB
) data to a TcpStream
and you should see an event with EPOLLPRI
.
from mio.
Hello, I am working with @poeschel on this problem. We have created a small test project which can be found here: https://github.com/poeschel/mio-pollpri-test
The program sends messages over a TCP socket and checks the received events. We also send a MSG_OOB
message. There you can see that the MSG_OOB
is in fact received, but does not contain the EPOLLPRI
flag, and does not have the priority
set to true
. Output from the program (only the second message to keep it brief) in this case:
[src/main.rs:43] event = Event {
token: Token(
1,
),
readable: true,
writable: false,
error: false,
read_closed: false,
write_closed: false,
priority: false, <<<<<
aio: false,
lio: false,
details: epoll_event {
events: EPOLLIN, <<<<<
u64: 1,
},
}
With the "horrible hack" posted above, the output changes to:
[src/main.rs:43] event = Event {
token: Token(
1,
),
readable: true,
writable: false,
error: false,
read_closed: false,
write_closed: false,
priority: true, <<<<<
aio: false,
lio: false,
details: epoll_event {
events: EPOLLIN|EPOLLPRI, <<<<<
u64: 1,
},
}
You can see that the flags contains EPOLLPRI
and the priority
field is set to true
. That likely means MSG_OOB
was received only because it also contains the EPOLLIN
flag.
As mentioned above, we work with V4L2
, and our events do only contain EPOLLPRI
. Changing the selector to generally also accept EPOLLPRI
events like in our hack, seems like a big breaking change, so we are not quite sure how to proceed.
from mio.
Hello, I am working with @poeschel on this problem. We have created a small test project which can be found here: https://github.com/poeschel/mio-pollpri-test
This program is incorrect. You should get only a single event for the send on line 20. You should drain the readiness, see https://docs.rs/mio/latest/mio/struct.Poll.html#readiness-operations, to get another event.
from mio.
I created pull-request #1646 that demonstrates the issue a bit better.
from mio.
... and I would suggest something like this as a possible solution: poeschel@282edd3
from mio.
Related Issues (20)
- compile time error inside `poll.rs` HOT 3
- poll: Optimize locks and allocations in the critical path
- Poll(2) implementation follow-ups
- Official ESP-IDF framework support HOT 3
- Make `CompletionPort` public? HOT 7
- No data coming from Poll HOT 8
- Difference behaves between Linux and Windows HOT 2
- How to wait for a socket to be writable? udp / Interest::READABLE | Interest::WRITABLE HOT 6
- could not compile mio due to 44 previous errors HOT 3
- WakerRegistrar mentioned in comment is not present HOT 2
- Decide MSRV for v1 HOT 2
- Use rustix instead of libc HOT 2
- Document MSRV policy HOT 1
- Update socket types API to match std lib HOT 4
- unresolved imports in target xtensa-esp32-espidf HOT 7
- `syscall!` macros hide unsafe code HOT 2
- why is it possible to create a mio TcpStream from std TcpStream but going the other way around is unsafe? HOT 13
- peek blocks after read on windows HOT 7
- Poll changing interest of server socket on Windows HOT 1
- Cannot continue listen! HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mio.