You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: daemon_monitor.rs
    path of file: ./repos/espanso/espanso/src/cli/worker
    
    the code of the file until where you have to start completion: /*
 * This file is part of espanso.
 *
 * Copyright (C) 2019-2021 Federico Terzi
 *
 * espanso is free software: you can redistribut
    
fn daemon_monitor_main(runtime_dir: &Path, exit_notify: Sender<ExitMode>) {
  info!("monitoring the status of the daemon process");

  loop {
    let is_daemon_lock_free = {
      let lock = acquire_daemon_lock(runtime_dir);
      lock.is_some()
    };

    if is_daemon_lock_free {
      warn!("detected unexpected daemon termination, sending exit signal to the engine");
      if let Err(error) = exit_notify.send(ExitMode::Exit) {
        error!("unable to send daemon exit signal: {}", error);
      }
      break;
    }

    std::thread::sleep(std::time::Duration::from_millis(
      DAEMON_STATUS_CHECK_INTERVAL,
    ));
  }
}