Skip to content

Commit

Permalink
Update library/std/src/sys/windows/pipe.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDenton committed Apr 4, 2022
1 parent 5475047 commit 62f37da
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions library/std/src/sys/windows/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,16 @@ impl AnonPipe {
}

// Wait indefinitely for the result.
while async_result.is_none() {
let result = loop {
// STEP 2: Enter an alertable state.
// The second parameter of `SleepEx` is used to make this sleep alertable.
c::SleepEx(c::INFINITE, c::TRUE);
}
if let Some(result) = async_result {
break result;
}
};
// STEP 4: Return the result.
// `async_result` is always `Some` at this point.
let result = async_result.unwrap();
// `async_result` is always `Some` at this point
match result.error {
c::ERROR_SUCCESS => Ok(result.transfered as usize),
error => Err(io::Error::from_raw_os_error(error as _)),
Expand Down

0 comments on commit 62f37da

Please sign in to comment.