Re: [PATCH 02/10] index-pack: remove #ifdef NO_PTHREADS
- From
Jeff King <peff@peff.net>
- Date
- Oct 27, 2018, 07:34 UTC
- Message-ID
- <20181027073446.GC26685@sigill.intra.peff.net>
- In-Reply-To
- <20181027071003.1347-3-pclouds@gmail.com>
On Sat, Oct 27, 2018 at 09:09:55AM +0200, Nguyễn Thái Ngọc Duy wrote:
Show 24 quoted lines
> static inline struct thread_local *get_thread_data(void)
> {
> -#ifndef NO_PTHREADS
> - if (threads_active)
> - return pthread_getspecific(key);
> - assert(!threads_active &&
> - "This should only be reached when all threads are gone");
> -#endif
> + if (HAVE_THREADS) {
> + if (threads_active)
> + return pthread_getspecific(key);
> + assert(!threads_active &&
> + "This should only be reached when all threads are gone");
> + }
> return ¬hread_data;
> }
>
> -#ifndef NO_PTHREADS
> static void set_thread_data(struct thread_local *data)
> {
> if (threads_active)
> pthread_setspecific(key, data);
> }
> -#endifIf we do the getspecific/setspecific thing I mentioned for the previous patch, then I think helpers like this can just go away.
-Peff