compio-rs / compio

A thread-per-core Rust runtime with IOCP/io_uring/polling.
MIT License
420 stars 37 forks source link

feat(driver): reduce eventfd IO #250

Closed Berrysoft closed 5 months ago

Berrysoft commented 5 months ago

Each call to Waker::wake writes to the eventfd, which is too annoying. This PR provides a faster path. When the waker is on the same thread, no need to write to the eventfd.

The enable_poll switch of proactor builder provides compatibility to custom event loops, which may poll the io-uring fd in other frameworks. When the switch is enabled, the fast path is disabled.

Berrysoft commented 5 months ago

Thanks to @oxalica, this PR also address two small fixes: