Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Sixt <johannes.sixt@telecom.at>2008-09-23 10:52:16 +0400
committerShawn O. Pearce <spearce@spearce.org>2008-09-29 19:22:40 +0400
commitd317851a7fd07f28890e6dc9bc2269da37c4122e (patch)
tree2d84be803142067df2c37dafe06df249fac7d4f6
parent07ad5a157d5f73941abfc3a511725d32e4c023d4 (diff)
compat/mingw: Support a timeout in the poll emulation if no fds are given
Our poll() emulation did not support the timeout argument. With this patch we support it for the simple case where poll() does not need to wait on file descriptors as well because this case amounts to a mere Sleep(). This is needed if the user sets help.autocorrect is set to a positive value. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r--compat/mingw.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index ccfa2a0a3d..7eed60db1b 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -263,8 +263,13 @@ int poll(struct pollfd *ufds, unsigned int nfds, int timeout)
{
int i, pending;
- if (timeout != -1)
+ if (timeout >= 0) {
+ if (nfds == 0) {
+ Sleep(timeout);
+ return 0;
+ }
return errno = EINVAL, error("poll timeout not supported");
+ }
/* When there is only one fd to wait for, then we pretend that
* input is available and let the actual wait happen when the