|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] Re: [PATCH V3] libxl, Introduce a QMP client
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
|
|
|
|
|