From: Junio C Hamano Date: Mon, 12 Oct 2015 15:57:38 GMT Subject: Re: thread-utils: build with NO_PTHREADS fails Message-ID: In-Reply-To: <6AE1604EE3EC5F4296C096518C6B77EE5D0FDAB9E8@mail.accesssoftek.com> Victor Leschuk writes: > I think that no one tried it for a long time but I needed a > single-threaded git version for debug purpose. I tried to build > with -DNO_PTHREADS and thread-utils.c failed to compile. > > In brief the situation is the following: > > in header file we have something like that: > > > #ifndef NO_PTHREAD > extern int online_cpus(void); > > #else > #define online_cpus() 1 > #endif // NO_PTHREAD > > and in *.c file: > > > int online_cpus(void) > { > // ... > } Yeah, that is obviously incorrect. The whole implementation of thread-utils.c should be enabled only under ifndef NO_PTHREADS and thread-utils.h should also privide a no-op macro for init_recursive_mutex() just like it already does for online_cpus(), which would make it unnecessary to have ifndef NO_PTHREADS sprinkled all over the place inside thread-utils.c, no?