We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5475047 commit 62f37daCopy full SHA for 62f37da
library/std/src/sys/windows/pipe.rs
@@ -308,14 +308,16 @@ impl AnonPipe {
308
}
309
310
// Wait indefinitely for the result.
311
- while async_result.is_none() {
+ let result = loop {
312
// STEP 2: Enter an alertable state.
313
// The second parameter of `SleepEx` is used to make this sleep alertable.
314
c::SleepEx(c::INFINITE, c::TRUE);
315
- }
+ if let Some(result) = async_result {
316
+ break result;
317
+ }
318
+ };
319
// STEP 4: Return the result.
- // `async_result` is always `Some` at this point.
- let result = async_result.unwrap();
320
+ // `async_result` is always `Some` at this point
321
match result.error {
322
c::ERROR_SUCCESS => Ok(result.transfered as usize),
323
error => Err(io::Error::from_raw_os_error(error as _)),
0 commit comments