Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventFd::defuse does not do what its documentation says #2583

Closed
blp opened this issue Jan 15, 2025 · 2 comments
Closed

EventFd::defuse does not do what its documentation says #2583

blp opened this issue Jan 15, 2025 · 2 comments

Comments

@blp
Copy link

blp commented Jan 15, 2025

EventFd::defuse is implemented and documented as follows:

    /// Defuses `self`, a following call to `poll`, `select` or `epoll` will block.
    /// 
    /// [`EventFd::write`] with `0`.
    pub fn defuse(&self) -> Result<usize> {
        self.write(0)
    }

However, writing to an eventfd adds the number written to a counter maintained in the event, so zero does not have any effect. To achieve the documented effect of causing the next call to block (for POLLIN, presumably), defuse should be implemented as self.read().

@SteveLauC
Copy link
Member

Yeah, thanks for reporting, this was reported before in #2422 and has been fixed

@SteveLauC
Copy link
Member

Close this issue as it has been fixed, but feel free to re-open it if you think it is unresolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants