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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 26.10.2011 22:08, schrieb Junio C Hamano:
> Junio C Hamano <gitster@xxxxxxxxx> 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é
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]