On Sat, May 29, 2010 at 8:37 PM, Jonathan Nieder [off-list ref] wrote:
[,,,]
+static int msleep(int timeout)
+{
+ struct timeval tv;
+ tv.tv_sec = 0;
+ tv.tv_usec = 1000 * timeout;
+ return select(0, NULL, NULL, NULL, &tv);
+}
This code will do the right thing only when timeout is < 1000. (This
is probably true for us in practice, so this is likely just
nitpicking.) For the general case, you'd want
tv.tv_sec = timeout / 1000;
tv.tv_usec = 1000 * (timeout % 1000);
--bert