MCPcopy Create free account
hub / github.com/git/git / init_dir_mutex

Function init_dir_mutex

name-hash.c:238–246  ·  view source on GitHub ↗

* Initialize n mutexes for use when searching and inserting * into "istate->dir_hash". All "dir" threads are trying * to insert partial pathnames into the hash as they iterate * over their portions of the index, so lock contention is * high. * * However, the hashmap is going to put items into bucket * chains based on their hash values. Use that to create n * mutexes and lock on mutex[buc

Source from the content-addressed store, hash-verified

236 * decrease the collision rate by (hopefully) a factor of n.
237 */
238static void init_dir_mutex(void)
239{
240 int j;
241
242 CALLOC_ARRAY(lazy_dir_mutex_array, LAZY_MAX_MUTEX);
243
244 for (j = 0; j < LAZY_MAX_MUTEX; j++)
245 init_recursive_mutex(&lazy_dir_mutex_array[j]);
246}
247
248static void cleanup_dir_mutex(void)
249{

Callers 1

Calls 1

init_recursive_mutexFunction · 0.85

Tested by

no test coverage detected