Skip to main content

wait_for_process_ready

Function wait_for_process_ready 

Source
pub fn wait_for_process_ready(
    sys: &mut System,
    name: &str,
    config: &Config,
) -> WallSwitchResult<()>
Expand description

Polls the system until the specified process is detected or the timeout is reached.

This implementation monitors the process list using a shared System state to prevent high CPU utilization during tight polling loops. Time tracking relies on Instant::now to bypass timer inaccuracies or drift introduced by the OS scheduler during sleep.

§Arguments

  • sys - A mutable reference to a shared System instance.
  • name - The name of the process to wait for.
  • config - Application configuration parameters.

§Errors

Returns a WallSwitchError::UnableToFind error if the process does not appear within the 5-second window.