grep: move sha1-reading mutex into low-level code
The multi-threaded git-grep code needs to serialize access to the thread-unsafe read_sha1_file call. It does this with a mutex that is local to builtin/grep.c. Let's instead push this down into grep.c, where it can be used by both builtin/grep.c and grep.c. This will let us safely teach the low-level grep.c code tricks that involve reading from the object db. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
78db6ea9dc
commit
b3aeb285d0
6
grep.c
6
grep.c
@ -826,6 +826,12 @@ static inline void grep_attr_unlock(void)
|
||||
if (grep_use_locks)
|
||||
pthread_mutex_unlock(&grep_attr_mutex);
|
||||
}
|
||||
|
||||
/*
|
||||
* Same as git_attr_mutex, but protecting the thread-unsafe object db access.
|
||||
*/
|
||||
pthread_mutex_t grep_read_mutex;
|
||||
|
||||
#else
|
||||
#define grep_attr_lock()
|
||||
#define grep_attr_unlock()
|
||||
|
Reference in New Issue
Block a user