[libvirt] [PATCH v4b] Add functions for handling exponential backoff loops.

Richard W.M. Jones rjones at redhat.com
Fri Apr 15 09:27:31 UTC 2016


On Fri, Apr 15, 2016 at 11:17:03AM +0200, Martin Kletzander wrote:
> I'm not keeping up with these patches, but why don't we have one
> function that initializes the @timeout on it's first run based on the
> parameters?  Actually, it would just use the timeout to keep one number,
> so it could be uint or something.  You could then basically do:
> 
>  while (virBackOffWait(&timeout, 1, 3000))

You would still need to initialize the timeout variable
somehow, since (in C):

  virTimeBackOffVar var;

  while (virTimeBackOffWhile(&var, 1, 3000)) {
    //...
  }

... there's no way to tell if it's the first run of the loop or not.

Given that you have to initialize 'var' somewhere, you might as well
have the virTimeBackOffStart function as in patch 4b.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the libvir-list mailing list