index-pack: guard nr_resolved_deltas reads by lock
commit8f82aad4e7baf32942eb2087a882e0f8646b2da8
authorThomas Rast <trast@student.ethz.ch>
Tue, 19 Mar 2013 14:16:41 +0000 (19 15:16 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 19 Mar 2013 15:40:47 +0000 (19 08:40 -0700)
tree201c0298e81b948a37fb98ccfaf00b27214fba98
parent3aba2fddcbff6ba611c05eabeb4a8561c119275f
index-pack: guard nr_resolved_deltas reads by lock

The threaded parts of index-pack increment the number of resolved
deltas in nr_resolved_deltas guarded by counter_mutex.  However, the
per-thread outer loop accessed nr_resolved_deltas without any locks.

This is not wrong as such, since it doesn't matter all that much
whether we get an outdated value.  However, unless someone proves that
this one lock makes all the performance difference, it would be much
cleaner to guard _all_ accesses to the variable with the lock.

The only such use is display_progress() in the threaded section (all
others are in the conclude_pack() callchain outside the threaded
part).  To make it obvious that it cannot deadlock, move it out of
work_mutex.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/index-pack.c