From: Albert Dvornik Date: Mon, 31 May 2010 12:12:01 GMT Subject: Re: [PATCH v2] compat: Add another rudimentary poll() emulation Message-ID: In-Reply-To: <20100530003718.GA27024@progeny.tock> On Sat, May 29, 2010 at 8:37 PM, Jonathan Nieder 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