All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Randall S. Becker" <rsbecker@nexbridge.com>
Cc: "'Han-Wen Nienhuys via GitGitGadget'" <gitgitgadget@gmail.com>,
	<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
Date: Tue, 24 Nov 2020 19:12:08 -0800	[thread overview]
Message-ID: <xmqqy2iqf7uf.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <011801d6c2ae$dcdbaad0$96930070$@nexbridge.com> (Randall S. Becker's message of "Tue, 24 Nov 2020 17:12:08 -0500")

"Randall S. Becker" <rsbecker@nexbridge.com> writes:

> 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.

We strongly prefer not to contaminate generic part of source with
platform specific conditional compilation.

If this were a much larger helper function, it might make sense to
perform the compat/*.c dance, but in this case:

 * [PATCH 1/2] that implements sleep_millisec() in git-compat-util.h
   as a static inline function; and then

 * [PATCH 2/2] that does the equivalent of your patch below, but in
   git-compat-util.h

might be the cleanest.

> 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

  reply	other threads:[~2020-11-25  3:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 19:10 [PATCH] move sleep_millisec to git-compat-util.h Han-Wen Nienhuys via GitGitGadget
2020-11-24 21:51 ` Junio C Hamano
2020-11-24 22:12   ` Randall S. Becker
2020-11-25  3:12     ` Junio C Hamano [this message]
2020-11-25 21:23       ` Randall S. Becker
2020-11-25 23:12         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqy2iqf7uf.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=hanwen@google.com \
    --cc=hanwenn@gmail.com \
    --cc=rsbecker@nexbridge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.