Dustin Sallings wrote: > On Sep 27, 2010, at 5:43, Simon Slavin wrote: > >> I think this differs for different platforms. For instance: >> >> http://www.manpagez.com/man/3/usleep/ >> >> makes no mention of that fault. > > It kind of does indirectly. It says it's built on nanosleep(), and > links to that doc which says this in their error section: > > [EINVAL] rqtp specified a nanosecond value less than zero or > greater than or equal to 1000 million. > > I didn't actually run into a problem with it, I just noticed that its > result isn't checked and documentation I was reading had it defined to fail. > >> Since the time for sleeping is an integer number of seconds it's probably >> simplest just to replace this call with one to sleep(10). sleep() is >> defined in POSIX.1 so I believe it should be available in a library for >> every platform SQLite is expected to run on. > > I think that makes sense. It also means you don't need a > comment describing that it's intended to sleep for exactly ten seconds. :)
Yes, that might be a problem. I see than in Vim source code, usleep() is used as follows to avoid calling usleep() with a large argument: #ifdef HAVE_NANOSLEEP ... #else # ifdef HAVE_USLEEP while (msec >= 1000) { usleep((unsigned int)(999 * 1000)); msec -= 999; } usleep((unsigned int)(msec * 1000)); # else ... #endif -- Dominique _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users