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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On November 24, 2020 4:51 PM, Junio C Hamano wrote:
> To: Han-Wen Nienhuys via GitGitGadget <gitgitgadget@xxxxxxxxx>
> Cc: git@xxxxxxxxxxxxxxx; Han-Wen Nienhuys <hanwenn@xxxxxxxxx>; Han-
> Wen Nienhuys <hanwen@xxxxxxxxxx>
> Subject: Re: [PATCH] move sleep_millisec to git-compat-util.h
> 
> "Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:
> 
> > From: Han-Wen Nienhuys <hanwen@xxxxxxxxxx>
> >
> > 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@xxxxxxxxxx>
> > ---
> >     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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux