public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Heiko Voigt <hvoigt@hvoigt•net>
To: Junio C Hamano <gitster@pobox•com>
Cc: git@vger•kernel.org, Johannes Schindelin <Johannes.Schindelin@gmx•de>
Subject: [PATCH] fix threaded grep for machines with only one cpu
Date: Mon, 15 Feb 2010 23:50:02 +0100	[thread overview]
Message-ID: <20100215225001.GA944@book.hvoigt.net> (raw)

In case the machine has only one cpu the initialization was
skipped.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt•net>
---
 builtin-grep.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/builtin-grep.c b/builtin-grep.c
index 26d4deb..644051c 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -220,12 +220,6 @@ static void start_threads(struct grep_opt *opt)
 {
 	int i;
 
-	pthread_mutex_init(&grep_mutex, NULL);
-	pthread_mutex_init(&read_sha1_mutex, NULL);
-	pthread_cond_init(&cond_add, NULL);
-	pthread_cond_init(&cond_write, NULL);
-	pthread_cond_init(&cond_result, NULL);
-
 	for (i = 0; i < ARRAY_SIZE(todo); i++) {
 		strbuf_init(&todo[i].out, 0);
 	}
@@ -880,6 +874,12 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 	if (online_cpus() == 1 || !grep_threads_ok(&opt))
 		use_threads = 0;
 
+	pthread_mutex_init(&grep_mutex, NULL);
+	pthread_mutex_init(&read_sha1_mutex, NULL);
+	pthread_cond_init(&cond_add, NULL);
+	pthread_cond_init(&cond_write, NULL);
+	pthread_cond_init(&cond_result, NULL);
+
 	if (use_threads)
 		start_threads(&opt);
 #else
-- 
1.7.0.rc1.7.gc0da5

             reply	other threads:[~2010-02-15 22:50 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-15 22:50 Heiko Voigt [this message]
2010-02-15 23:09 ` [PATCH] fix threaded grep for machines with only one cpu 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
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=20100215225001.GA944@book.hvoigt.net \
    --to=hvoigt@hvoigt$(echo .)net \
    --cc=Johannes.Schindelin@gmx$(echo .)de \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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