Yield the thread when waiting to delete a file

This commit is contained in:
Chris Denton 2022-04-28 18:46:33 +01:00
parent 8dc4696b3b
commit d579665bd1
No known key found for this signature in database
GPG Key ID: 713472F2F45627DE

View File

@ -14,6 +14,7 @@
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 copy_handle(f: &File) -> mem::ManuallyDrop<File> {
// Otherwise return the error.
Err(e) => return Err(e),
}
thread::yield_now();
}
}
}
@ -1072,6 +1074,7 @@ fn copy_handle(f: &File) -> mem::ManuallyDrop<File> {
if i == MAX_RETRIES || e.kind() != io::ErrorKind::DirectoryNotEmpty {
return Err(e);
}
thread::yield_now();
} else {
break;
}