On Mon, Nov 06, 2017 at 05:29:26PM +0000, Bodireddy, Bhanuprakash wrote: > Hi Ben, > > > >On Fri, Sep 15, 2017 at 05:40:23PM +0100, Bhanuprakash Bodireddy wrote: > >> This commit introduces xnanosleep() for the threads needing high > >> resolution sleep timeouts. > >> > >> Signed-off-by: Bhanuprakash Bodireddy > >> <[email protected]> > > > >This is a little confusing. The name xnanosleep() implies that its argument > >would be in nanoseconds, but it's in fact in milliseconds. > >Second, I don't understand why it's only implemented for Linux. > > I tried reworking this API with nanoseconds argument and implementing > nsec_to_timespec() today. > This changes works fine on Linux, however the windows build breaks with below > error as reported by appveyor. > > error C4013: 'nanosleep' undefined; assuming extern returning int > (windows.h and time.h headers are included). > > But looks like nanosleep is supported on windows. Any inputs on this would be > helpful.
If nanosleep isn't available on Windows (it looks like it isn't), then I'd recommend using some other function that Windows does have. If its argument isn't in nanoseconds, you can convert it. If you don't really need nanosecond resolution (the fact that the argument was in milliseconds seems like a hint), then maybe you could just use some other function instead of nanosleep, even on Linux. This stackoverflow page has some information: https://stackoverflow.com/questions/7827062/is-there-a-windows-equivalent-of-nanosleep _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
