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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]