git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] fix threaded grep for machines with only one cpu

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 17, 2010, 01:26 UTC
Message-ID
<7vvddwodox.fsf@alter.siamese.dyndns.org>
In-Reply-To
<alpine.DEB.1.00.1002170200370.20986@pacific.mpi-cbg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 10 quoted lines
>> 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.
Previous: Johannes SchindelinNext: Nicolas Pitre
Message 11 of 26 in “fix threaded grep for machines with only one cpu”
  1. fix threaded grep for machines with only one cpuHeiko Voigt, Feb 15, 2010
  2. Johannes SchindelinFeb 15, 2010
  3. Junio C HamanoFeb 16, 2010
  4. Junio C HamanoFeb 16, 2010
  5. Junio C HamanoFeb 16, 2010
  6. Junio C HamanoFeb 16, 2010
  7. Fredrik KuivinenFeb 16, 2010
  8. Johannes SchindelinFeb 16, 2010
  9. Junio C HamanoFeb 16, 2010
  10. Johannes SchindelinFeb 17, 2010
  11. Junio C HamanoFeb 17, 2010
  12. Nicolas PitreFeb 17, 2010
  13. Heiko VoigtFeb 17, 2010
  14. Johannes SchindelinFeb 18, 2010
  15. Heiko VoigtFeb 16, 2010
  16. Nicolas PitreFeb 16, 2010
  17. Junio C HamanoFeb 16, 2010
  18. Sverre RabbelierFeb 16, 2010
  19. Nicolas PitreFeb 16, 2010
  20. Johannes SchindelinFeb 16, 2010
  21. Nicolas PitreFeb 16, 2010
  22. Heiko VoigtFeb 16, 2010
  23. Nicolas PitreFeb 16, 2010
  24. Junio C HamanoFeb 16, 2010
  25. Heiko VoigtFeb 17, 2010
  26. Paolo BonziniFeb 17, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.