git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Pitre <nico@fluxnic.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Heiko Voigt <hvoigt@hvoigt.net>,
	Fredrik Kuivinen <frekui@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] fix threaded grep for machines with only one cpu
Date: Tue, 16 Feb 2010 21:41:20 -0500 (EST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1002162140110.1946@xanadu.home> (raw)
In-Reply-To: <7vvddwodox.fsf@alter.siamese.dyndns.org>

On Tue, 16 Feb 2010, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> >> 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>
> >> Acked-by: Fredrik Kuivinen <frekui@gmail.com>
> >> ---
> >
> > Yes, this one looks much, much nicer.
> 
> The structure may be much nicer, but one remaining thing is that I do not
> think foo_locked() is a good name; IIRC, kernel folks use _locked() suffix
> when the caller is expected to already hold the lock.  So a typical naming
> convention goes like this:
> 
> 	foo()
>         {
>         	lock();
>                 foo_locked();
>                 unlock();
>         }
> 
> but what the patch did was the other way around:
> 
> 	read_sha1_file_locked()
>         {
>         	lock();
>                 read_sha1_file();
>                 unlock();
> 	}
> 
> which is probably against the convention many readers of our codebase are
> already familiar with.
> 
> We need a better name to unconfuse people, I think.

lock_and_read_sha1_file()


Nicolas

  reply	other threads:[~2010-02-17  2:41 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
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 [this message]
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=alpine.LFD.2.00.1002162140110.1946@xanadu.home \
    --to=nico@fluxnic.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=frekui@gmail.com \
    --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).