We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8f7afa7 commit ff5da1fCopy full SHA for ff5da1f
1 file changed
src/uucore/src/lib/features/process.rs
@@ -141,10 +141,11 @@ impl ChildExt for Child {
141
break;
142
}
143
144
- // XXX: this is kinda gross, but it's cleaner than starting a thread just to wait
145
- // (which was the previous solution). We might want to use a different duration
146
- // here as well
147
- thread::sleep(Duration::from_millis(100));
+ // Yield back to the OS' scheduler; this is better than just arbitrarily
+ // waiting and the usually preferred solution, spinning with
+ // [`std::hint::spin_loop()`], because the operations here are all
+ // OS-related and orders of magnitude slower than single CPU operations.
148
+ thread::yield_now();
149
150
151
Ok(None)
0 commit comments