aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/index-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-01-16 10:11:58 -0800
committerJunio C Hamano <gitster@pobox.com>2024-01-16 10:11:58 -0800
commitb27f67aa932e61906ad92bd09d3051d9c54eb148 (patch)
treeee19f93e1c82e155fecf0520e288518d0d68258d /builtin/index-pack.c
parentMerge branch 'cp/sideband-array-index-comment-fix' (diff)
parentindex-pack: spawn threads atomically (diff)
downloadgit-b27f67aa932e61906ad92bd09d3051d9c54eb148.tar.gz
git-b27f67aa932e61906ad92bd09d3051d9c54eb148.zip
Merge branch 'jk/index-pack-lsan-false-positive-fix'
Fix false positive reported by leak sanitizer. * jk/index-pack-lsan-false-positive-fix: index-pack: spawn threads atomically
Diffstat (limited to 'builtin/index-pack.c')
-rw-r--r--builtin/index-pack.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 0841b6940a..1ea87e01f2 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1255,6 +1255,7 @@ static void resolve_deltas(void)
base_cache_limit = delta_base_cache_limit * nr_threads;
if (nr_threads > 1 || getenv("GIT_FORCE_THREADS")) {
init_thread();
+ work_lock();
for (i = 0; i < nr_threads; i++) {
int ret = pthread_create(&thread_data[i].thread, NULL,
threaded_second_pass, thread_data + i);
@@ -1262,6 +1263,7 @@ static void resolve_deltas(void)
die(_("unable to create thread: %s"),
strerror(ret));
}
+ work_unlock();
for (i = 0; i < nr_threads; i++)
pthread_join(thread_data[i].thread, NULL);
cleanup_thread();