On November 24, 2020 10:12 PM, Junio C Hamano wrote: > "Randall S. Becker" <rsbecker@xxxxxxxxxxxxx> 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) I just chatted with my team and we think that sticking with the existing poll call is probably better in the long term. We are planning to try to get git to work using PUT threads - but that is a longer project for a whole slew of reasons. It involves pulling all or most of the FLOSS stuff out, or making that configurable to use FLOSS when not using threads and not using FLOSS when using threads. It might be useful, however, to use usleep() instead of poll(NULL) when threading is used on most platforms as it is a more effective way of context switching between threads than select(). Regards, Randall