Skip to content

Commit

Permalink
refactor: remove EventFd::defuse() and EventFd::arm() (nix-rust#2452)
Browse files Browse the repository at this point in the history
* fix: remove Eventfd::arm() and defuse()

* chore: changelog entry
  • Loading branch information
SteveLauC authored Jun 17, 2024
1 parent 8d9c880 commit 95bedfd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
1 change: 1 addition & 0 deletions changelog/2452.removed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`EventFd::defuse()` is removed because it does nothing, `EventFd::arm()` is also removed for symmetry reasons.
2 changes: 1 addition & 1 deletion src/sys/epoll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl EpollEvent {
/// epoll.add(&eventfd, EpollEvent::new(EpollFlags::EPOLLIN,DATA))?;
///
/// // Arm eventfd & Time wait
/// eventfd.arm()?;
/// eventfd.write(1)?;
/// let now = Instant::now();
///
/// // Wait on event
Expand Down
14 changes: 0 additions & 14 deletions src/sys/eventfd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,6 @@ impl EventFd {
Self::from_value_and_flags(init_val, EfdFlags::empty())
}

/// Arms `self`, a following call to `poll`, `select` or `epoll` will return immediately.
///
/// [`EventFd::write`] with `1`.
pub fn arm(&self) -> Result<usize> {
self.write(1)
}

/// 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)
}

/// Enqueues `value` triggers, i.e., adds the integer value supplied in `value`
/// to the counter.
///
Expand Down

0 comments on commit 95bedfd

Please sign in to comment.