From: Fredrik Kuivinen <frekui@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Heiko Voigt <hvoigt@hvoigt.net>,
git@vger.kernel.org,
Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH] fix threaded grep for machines with only one cpu
Date: Tue, 16 Feb 2010 08:54:00 +0100 [thread overview]
Message-ID: <4c8ef71002152354s3be9503aja28e5426a735ca07@mail.gmail.com> (raw)
In-Reply-To: <7vljetlx8r.fsf@alter.siamese.dyndns.org>
On Tue, Feb 16, 2010 at 03:39, Junio C Hamano <gitster@pobox.com> wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Is this the answer to my question?
>
> IOW, please try this patch. I am planning to queue it to 'maint' as part
> of 1.7.0.1 if this is the right solution (which I obviously think it is).
>
> -- >8 --
> From: Junio C Hamano <gitster@pobox.com>
> Date: Mon, 15 Feb 2010 18:34:28 -0800
> Subject: [PATCH] Fix use of mutex in threaded grep
>
> The program can decide at runtime not to use threading even if the
> support is compiled in. In such a case, mutexes are not necessary
> and left uninitialized. But the code incorrectly tried to take and
> release the read_sha1_mutex unconditionally.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> builtin-grep.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/builtin-grep.c b/builtin-grep.c
> index 26d4deb..5c1545e 100644
> --- a/builtin-grep.c
> +++ b/builtin-grep.c
> @@ -81,8 +81,8 @@ static pthread_mutex_t read_sha1_mutex;
>
> #define grep_lock() pthread_mutex_lock(&grep_mutex)
> #define grep_unlock() pthread_mutex_unlock(&grep_mutex)
> -#define read_sha1_lock() pthread_mutex_lock(&read_sha1_mutex)
> -#define read_sha1_unlock() pthread_mutex_unlock(&read_sha1_mutex)
> +#define read_sha1_lock() do { if (use_threads) pthread_mutex_lock(&read_sha1_mutex); } while (0)
> +#define read_sha1_unlock() do { if (use_threads) pthread_mutex_unlock(&read_sha1_mutex); } while (0)
>
> /* Signalled when a new work_item is added to todo. */
> static pthread_cond_t cond_add;
This is the correct fix. Thanks.
Acked-by: Fredrik Kuivinen <frekui@gmail.com>
- Fredrik
next prev parent reply other threads:[~2010-02-16 7:54 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-15 22:50 [PATCH] fix threaded grep for machines with only one cpu Heiko Voigt
2010-02-15 23:09 ` Johannes Schindelin
2010-02-16 1:07 ` Junio C Hamano
2010-02-16 1:12 ` Junio C Hamano
2010-02-16 2:32 ` Junio C Hamano
2010-02-16 2:39 ` Junio C Hamano
2010-02-16 7:54 ` Fredrik Kuivinen [this message]
2010-02-16 8:15 ` Johannes Schindelin
2010-02-16 23:59 ` Junio C Hamano
2010-02-17 1:01 ` Johannes Schindelin
2010-02-17 1:26 ` Junio C Hamano
2010-02-17 2:41 ` Nicolas Pitre
2010-02-17 22:43 ` Heiko Voigt
2010-02-18 9:10 ` Johannes Schindelin
2010-02-16 18:02 ` Heiko Voigt
2010-02-16 18:59 ` Nicolas Pitre
2010-02-16 19:20 ` Junio C Hamano
2010-02-16 19:26 ` Sverre Rabbelier
2010-02-16 20:00 ` Nicolas Pitre
2010-02-16 20:19 ` Johannes Schindelin
2010-02-16 20:37 ` Nicolas Pitre
2010-02-16 20:57 ` Heiko Voigt
2010-02-16 21:20 ` Nicolas Pitre
2010-02-16 22:54 ` Junio C Hamano
2010-02-17 17:56 ` Heiko Voigt
2010-02-17 15:29 ` Paolo Bonzini
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=4c8ef71002152354s3be9503aja28e5426a735ca07@mail.gmail.com \
--to=frekui@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hvoigt@hvoigt.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).