Thread (39 messages) flat view 39 messages, 14 authors, 2016-06-15

Re: [PATCH v2] compat: Add another rudimentary poll() emulation

From: Albert Dvornik <hidden>
Date: 2016-06-15 22:48:53

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help