git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] compat/mingw: Support a timeout in the poll emulation if no fds are given

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Sep 23, 2008, 06:52 UTC
Message-ID
<48D89220.6080802@viscovery.net>
From: Johannes Sixt <johannes.sixt@telecom.at>

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>
---
 compat/mingw.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index ccfa2a0..7eed60d 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
-- 
1.6.0.2.1220.gd1ae.dirty
Message 1 of 1 in “compat/mingw: Support a timeout in the poll emulation if no fds are given”
  1. compat/mingw: Support a timeout in the poll emulation if no fds are givenJohannes Sixt, Sep 23, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.