Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
notgull committed Aug 9, 2023
1 parent aa317f3 commit 0942099
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/os/iocp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ pub trait PollerIocpExt: PollerSealed {
/// let poller = Poller::new().unwrap();
///
/// // Add the child process to the poller.
/// poller.add_waitable(child, Event::both(0), PollMode::Oneshot).unwrap();
/// poller.add_waitable(&child, Event::all(0), PollMode::Oneshot).unwrap();
///
/// // Wait for the child process to exit.
/// let mut events = vec![];
/// poller.wait(&mut events, None).unwrap();
///
/// assert_eq!(events.len(), 1);
/// assert_eq!(events[0], Event::both(0));
/// assert_eq!(events[0], Event::all(0));
/// ```
fn add_waitable(
&self,
Expand Down Expand Up @@ -123,17 +123,17 @@ pub trait PollerIocpExt: PollerSealed {
/// let poller = Poller::new().unwrap();
///
/// // Add the child process to the poller.
/// poller.add_waitable(child, Event::both(0), PollMode::Oneshot).unwrap();
/// poller.add_waitable(&child, Event::all(0), PollMode::Oneshot).unwrap();
///
/// // Wait for the child process to exit.
/// let mut events = vec![];
/// poller.wait(&mut events, None).unwrap();
///
/// assert_eq!(events.len(), 1);
/// assert_eq!(events[0], Event::both(0));
/// assert_eq!(events[0], Event::all(0));
///
/// // Modify the waitable handle.
/// poller.modify_waitable(child, Event::readable(0), PollMode::Oneshot).unwrap();
/// poller.modify_waitable(&child, Event::readable(0), PollMode::Oneshot).unwrap();
/// ```
fn modify_waitable(
&self,
Expand Down Expand Up @@ -167,17 +167,17 @@ pub trait PollerIocpExt: PollerSealed {
/// let poller = Poller::new().unwrap();
///
/// // Add the child process to the poller.
/// poller.add_waitable(child, Event::both(0), PollMode::Oneshot).unwrap();
/// poller.add_waitable(&child, Event::all(0), PollMode::Oneshot).unwrap();
///
/// // Wait for the child process to exit.
/// let mut events = vec![];
/// poller.wait(&mut events, None).unwrap();
///
/// assert_eq!(events.len(), 1);
/// assert_eq!(events[0], Event::both(0));
/// assert_eq!(events[0], Event::all(0));
///
/// // Remove the waitable handle.
/// poller.remove_waitable(child).unwrap();
/// poller.remove_waitable(&child).unwrap();
/// ```
fn remove_waitable(&self, handle: impl Waitable) -> io::Result<()>;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/windows_waitable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl EventHandle {

/// Reset the event object.
fn reset(&self) -> io::Result<()> {
if unsafe { ResetEvent(self.0 as _) } == 0 {
if unsafe { ResetEvent(self.0 as _) } != 0 {
Ok(())
} else {
Err(io::Error::last_os_error())
Expand All @@ -52,7 +52,7 @@ impl EventHandle {

/// Set the event object.
fn set(&self) -> io::Result<()> {
if unsafe { SetEvent(self.0 as _) } == 0 {
if unsafe { SetEvent(self.0 as _) } != 0 {
Ok(())
} else {
Err(io::Error::last_os_error())
Expand Down

0 comments on commit 0942099

Please sign in to comment.