def observing_thread(callable, initial_wait, periodic_wait)
      thread = Thread.new(&callable)
      wait_for_exit(thread, initial_wait)
      loop do
        break if wait_for_exit(thread, periodic_wait)

        yield
      end
      thread.value
    end
def observing_thread(callable, initial_wait, periodic_wait)
      thread = Thread.new(&callable)
      wait_for_exit(thread, initial_wait)
      loop do
        break if wait_for_exit(thread, periodic_wait)

        yield
      end
      thread.value
    end
Starts the `callable` in a background thread and waits for it to complete.
 If the callable fails with an exception, it will be raised here. Otherwise
 the main thread is paused for an `initial_wait` time in seconds, and
 subsequently for `periodic_wait` repeatedly until the thread completes.
 After each wait, `yield` is called to allow a block to execute.