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

Re: [Xen-devel] Re: [PATCH V3] libxl, Introduce a QMP client


  • To: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • From: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
  • Date: Thu, 16 Jun 2011 11:57:35 +0100
  • Cc: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>, Xen Devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
  • Delivery-date: Thu, 16 Jun 2011 03:59:52 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=xGZAXIGEA7aaigaBiwMTPEVwv3WHrnfNFiaHJKbFjOuVecgBfZUcSlEmgkWr1UXrOz wSJ+LzfWUEEeWIMRvi02AoNF5Oyk30sTRCPvwVSPlM0xqnnDi2jJcBLlc06NyoRUb1lB /Nh26V49Funh9QTUM6d0mTONhcNSgy2u9pqHA=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

On Wed, Jun 15, 2011 at 7:44 PM, Anthony PERARD
<anthony.perard@xxxxxxxxxx> wrote:
>>> +    do {
>>> +        ret = connect(qmp->qmp_fd, (struct sockaddr *) &qmp->addr,
>>> +                      sizeof (qmp->addr));
>>> +        if (ret == 0)
>>> +            break;
>>> +        if (errno == ENOENT || errno == ECONNREFUSED) {
>>> +            /* ENOENT       : Socket may not have shown up yet
>>> +             * ECONNREFUSED : Leftover socket hasn't been removed yet */
>>> +            continue;
>>> +        }
>>> +        return -1;
>>> +    } while ((++i <= timeout * 5) && (usleep(.2 * 1000000) <= 0));
>>
>> usleep (effectively) takes an unsigned int, what typedoes .2 * x become?
>
> It should be a float. But have 0.2 * 10^6 will be better to understand
> that we have 0.2 second of sleep, but not power in C. If you prefere,
> I will just wrote 200000, should be OK.

I think the standard way for making things like this more readable is
something like:

#define MS (1000)
...
usleep(200 * MS);

But if there's only one sleep, it's probably bike-shedding either way.

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.