about summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
authorChris Denton <christophersdenton@gmail.com>2022-04-28 18:46:33 +0100
committerChris Denton <christophersdenton@gmail.com>2022-04-28 18:53:12 +0100
commitd579665bd1e1649c9597cdaf3da3c2ca7f54e793 (patch)
tree33ecdb25c0dfcc0bc2ad2252afd8a0a3df2d86e0 /library/std/src/sys
parent8dc4696b3b8e048ddbc4a25953cccb567b27570c (diff)
downloadrust-d579665bd1e1649c9597cdaf3da3c2ca7f54e793.tar.gz
rust-d579665bd1e1649c9597cdaf3da3c2ca7f54e793.zip
Yield the thread when waiting to delete a file
Diffstat (limited to 'library/std/src/sys')
-rw-r--r--library/std/src/sys/windows/fs.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/std/src/sys/windows/fs.rs b/library/std/src/sys/windows/fs.rs
index e6f0f0f3023..5e055307c29 100644
--- a/library/std/src/sys/windows/fs.rs
+++ b/library/std/src/sys/windows/fs.rs
@@ -14,6 +14,7 @@ use crate::sys::handle::Handle;
 use crate::sys::time::SystemTime;
 use crate::sys::{c, cvt};
 use crate::sys_common::{AsInner, FromInner, IntoInner};
+use crate::thread;
 
 use super::path::maybe_verbatim;
 use super::to_u16s;
@@ -1059,6 +1060,7 @@ fn remove_dir_all_iterative(f: &File, delete: fn(&File) -> io::Result<()>) -> io
                         // Otherwise return the error.
                         Err(e) => return Err(e),
                     }
+                    thread::yield_now();
                 }
             }
         }
@@ -1072,6 +1074,7 @@ fn remove_dir_all_iterative(f: &File, delete: fn(&File) -> io::Result<()>) -> io
                         if i == MAX_RETRIES || e.kind() != io::ErrorKind::DirectoryNotEmpty {
                             return Err(e);
                         }
+                        thread::yield_now();
                     } else {
                         break;
                     }