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

Re: [PATCH] git grep: be careful to use mutices only when they are initialized

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Oct 27, 2011, 15:27 UTC
Message-ID
<4EA97848.9080008@lsrfire.ath.cx>
In-Reply-To
<7vmxcn1pob.fsf@alter.siamese.dyndns.org>
Am 26.10.2011 22:08, schrieb Junio C Hamano:
Show 15 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> 
>> The remainder of this message are hints and random thoughts on potential
>> follow-up patches that may want to build on top of this patch for further
>> clean-ups (not specifically meant for Dscho but for other people on both
>> mailing lists).
>> ...
>>  - Could we lose "#ifndef NO_PTHREADS" inside grep_sha1(), grep_file(),
>>    and possibly cmd_grep() functions and let the compiler optimize things
>>    away under NO_PTHREADS compilation?
> 
> I suspect that the result of the conversion would look a lot cleaner if
> the code is first cleaned up to move global variable like skip_first_line
> and the mutexes into the grep_opt structure. Without such clean-up, I do
> not think a conversion like this does not add much value.

Each thread get its own copy of the grep_opt struct, but the mutexes and also skip_first_line must not be duplicated. They could be moved into a new struct that is pointed to by grep_opt, but I'm not sure it's a win.

René
Previous: Junio C HamanoNext: Jeff King
Message 10 of 11 in “git grep: be careful to use mutices only when they are initialized”
  1. git grep: be careful to use mutices only when they are initializedJohannes Schindelin, Oct 25, 2011
  2. Tay Ray ChuanOct 26, 2011
  3. Johannes SchindelinOct 26, 2011
  4. Pat ThoytsOct 26, 2011
  5. Junio C HamanoOct 26, 2011
  6. Johannes SchindelinOct 26, 2011
  7. Junio C HamanoOct 26, 2011
  8. Junio C HamanoOct 26, 2011
  9. Junio C HamanoOct 26, 2011
  10. René ScharfeOct 27, 2011
  11. Jeff KingOct 27, 2011

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.