Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ågren <martin.agren@gmail.com>2017-08-21 20:43:46 +0300
committerJunio C Hamano <gitster@pobox.com>2017-08-23 20:14:19 +0300
commit0c2ad00b3c5a822224265c2551844b2eafc89875 (patch)
treefb3e9dfbd527040cee900ac0ba744798a9b8a9c5 /strbuf.h
parent5c94c93d504e29c2099200a68926a34072cf2736 (diff)
pack-objects: take lock before accessing `remaining`
When checking the conditional of "while (me->remaining)", we did not hold the lock. Calling find_deltas would still be safe, since it checks "remaining" (after taking the lock) and is able to handle all values. In fact, this could (currently) not trigger any bug: a bug could happen if `remaining` transitioning from zero to non-zero races with the evaluation of the while-condition, but these are always separated by the data_ready-mechanism. Make sure we have the lock when we read `remaining`. This does mean we release it just so that find_deltas can take it immediately again. We could tweak the contract so that the lock should be taken before calling find_deltas, but let's defer that until someone can actually show that "unlock+lock" has a measurable negative impact. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'strbuf.h')
0 files changed, 0 insertions, 0 deletions