Skip to content

Commit d579665

Browse files
committed
Yield the thread when waiting to delete a file
1 parent 8dc4696 commit d579665

File tree

1 file changed

+3
-0
lines changed
  • library/std/src/sys/windows

1 file changed

+3
-0
lines changed

library/std/src/sys/windows/fs.rs

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use crate::sys::handle::Handle;
1414
use crate::sys::time::SystemTime;
1515
use crate::sys::{c, cvt};
1616
use crate::sys_common::{AsInner, FromInner, IntoInner};
17+
use crate::thread;
1718

1819
use super::path::maybe_verbatim;
1920
use super::to_u16s;
@@ -1059,6 +1060,7 @@ fn remove_dir_all_iterative(f: &File, delete: fn(&File) -> io::Result<()>) -> io
10591060
// Otherwise return the error.
10601061
Err(e) => return Err(e),
10611062
}
1063+
thread::yield_now();
10621064
}
10631065
}
10641066
}
@@ -1072,6 +1074,7 @@ fn remove_dir_all_iterative(f: &File, delete: fn(&File) -> io::Result<()>) -> io
10721074
if i == MAX_RETRIES || e.kind() != io::ErrorKind::DirectoryNotEmpty {
10731075
return Err(e);
10741076
}
1077+
thread::yield_now();
10751078
} else {
10761079
break;
10771080
}

0 commit comments

Comments
 (0)