On 04/23/2014 04:26 AM, Daniel P. Berrange wrote: > The gnulib usleep replacement says > > /* This file is _intentionally_ light-weight. Rather than using > select or nanosleep, both of which drag in external libraries on > some platforms, this merely rounds up to the nearest second if > usleep() does not exist. If sub-second resolution is important, > then use a more powerful interface to begin with. */ >
> > The 'sleep' replacement on Win32 calls into the Win32-specific Sleep() > function which allows milli-second granularity. Why doesn't usleep() > call into Sleep() directly, so it gets milli-second granularity rather > than rounding up to the nearest second ? Good idea. I can work on that. > > In libvirt at least, we intentionally use usleep() over sleep() because > we really do want sub-second granularity, which makes gnulib's usleep > replacement rather unhelpful :-( I'd venture to suggest that the majority > of apps using usleep only need milli-second granularity, so an impl that > used Sleep() on Win32 would be pretty spot-on. You've convinced me :) -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature