Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/uucore/src/lib/features/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,11 @@ impl ChildExt for Child {
break;
}

// XXX: this is kinda gross, but it's cleaner than starting a thread just to wait
// (which was the previous solution). We might want to use a different duration
// here as well
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.
thread::yield_now();
}

Ok(None)
Expand Down
Loading