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

RE: [PATCH] move sleep_millisec to git-compat-util.h

From
Randall S. Becker <rsbecker@nexbridge.com>
Date
Nov 24, 2020, 22:12 UTC
Message-ID
<011801d6c2ae$dcdbaad0$96930070$@nexbridge.com>
In-Reply-To
<xmqq8saqifu3.fsf@gitster.c.googlers.com>
On November 24, 2020 4:51 PM, Junio C Hamano wrote:
Show 17 quoted lines
> To: Han-Wen Nienhuys via GitGitGadget <gitgitgadget@gmail.com>
> Cc: git@vger.kernel.org; Han-Wen Nienhuys <hanwenn@gmail.com>; Han-
> Wen Nienhuys <hanwen@google.com>
> Subject: Re: [PATCH] move sleep_millisec to git-compat-util.h
> 
> "Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 
> > From: Han-Wen Nienhuys <hanwen@google.com>
> >
> > The sleep function is defined in wrapper.c, so it makes more sense to
> > be a in system compatibility header.
> >
> > Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
> > ---
> >     move sleep_millisec to git-compat-util.h
> 
> Makes sense.

I have a platform fix that I'd like to apply once this makes it into the main code. The sleep_millisec uses poll(), which is rather heavy-weight on the NonStop platform. We have a much more efficient sleep function available (with microsecond resolution), which would be more useful unless there is a poll side-effect on which git depends. Would this be acceptable? I could push this at any time really.

index bcda41e374..972ecd67bf 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -4,6 +4,10 @@
 #include "cache.h"
 #include "config.h"

+#ifdef __TANDEM
+#include <cextdecs> /* for PROCESS_DELAY_ */
+#endif
+
 static int memory_limit_check(size_t size, int gentle)
 {
        static size_t limit = 0;
@@ -650,7 +654,11 @@ void write_file(const char *path, const char *fmt, ...)

 void sleep_millisec(int millisec)
 {
+#ifdef __TANDEM
+       PROCESS_DELAY_(millisec * 1000LL);
+#else
        poll(NULL, 0, millisec);
+#endif
 }

 int xgethostname(char *buf, size_t len)

Regards,
Randall
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 6 in “move sleep_millisec to git-compat-util.h”
  1. move sleep_millisec to git-compat-util.hHan-Wen Nienhuys via GitGitGadget, Nov 24, 2020
  2. Junio C HamanoNov 24, 2020
  3. Randall S. BeckerNov 24, 2020
  4. Junio C HamanoNov 25, 2020
  5. Randall S. BeckerNov 25, 2020
  6. Junio C HamanoNov 25, 2020

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.