From: Junio C Hamano Date: Fri, 16 Dec 2011 17:34:07 GMT Subject: Re: [PATCH v3 2/3] grep: enable threading with -p and -W using lazy attribute lookup Message-ID: <7vvcpgifow.fsf@alter.siamese.dyndns.org> In-Reply-To: <4EEAFFAF.8030003@viscovery.net> Johannes Sixt writes: > This is the first time we use pthread_mutex_t in a header file. We need at > least the following squashed in. An alternative would be to include > "thread-utils.h", but thread-utils is really more about implementation > helpers functions, not about types,... builtin/grep.c already uses thread-utils.h since 5b594f4 (Threaded grep, 2010-01-25), so does builtin/pack-objects.c since 833e3df (pack-objects: Add runtime detection of online CPU's, 2008-02-22), so it may be simpler to do so in grep.h instead. diff --git a/builtin/grep.c b/builtin/grep.c index bc23c3c..6474eed 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -17,7 +17,6 @@ #include "grep.h" #include "quote.h" #include "dir.h" -#include "thread-utils.h" static char const * const grep_usage[] = { "git grep [options] [-e] [...] [[--] ...]", diff --git a/grep.h b/grep.h index 15d227c..dd4c65e 100644 --- a/grep.h +++ b/grep.h @@ -133,8 +133,11 @@ extern struct grep_opt *grep_opt_dup(const struct grep_opt *opt); extern int grep_threads_ok(const struct grep_opt *opt); #ifndef NO_PTHREADS -/* Mutex used around access to the attributes machinery if - * opt->use_threads. Must be initialized/destroyed by callers! */ +#include "thread-utils.h" +/* + * Mutex used around access to the attributes machinery if + * opt->use_threads. Must be initialized/destroyed by callers! + */ extern pthread_mutex_t grep_attr_mutex; #endif