summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6fbe42c)
raw | patch | inline | side by side (parent: 6fbe42c)
author | Johannes Sixt <johannes.sixt@telecom.at> | |
Mon, 17 Dec 2007 19:12:52 +0000 (20:12 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 18 Dec 2007 00:08:40 +0000 (16:08 -0800) |
A mutex and a condition variable is allocated for each thread and torn
down when the thread terminates. However, for certain workloads it can
happen that some threads are actually not started at all. In this case
we would leak the mutex and condition variable. Now we allocate them only
for those threads that are actually started.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
down when the thread terminates. However, for certain workloads it can
happen that some threads are actually not started at all. In this case
we would leak the mutex and condition variable. Now we allocate them only
for those threads that are actually started.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-pack-objects.c | patch | blob | history |
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 5765d02f54d7a7b8b7b463c15b48d151858eeb87..e0ce114be7f65307da96bc620d5fb8902b793c73 100644 (file)
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
p[i].processed = processed;
p[i].working = 1;
p[i].data_ready = 0;
- pthread_mutex_init(&p[i].mutex, NULL);
- pthread_cond_init(&p[i].cond, NULL);
/* try to split chunks on "path" boundaries */
while (sub_size < list_size && list[sub_size]->hash &&
for (i = 0; i < delta_search_threads; i++) {
if (!p[i].list_size)
continue;
+ pthread_mutex_init(&p[i].mutex, NULL);
+ pthread_cond_init(&p[i].cond, NULL);
ret = pthread_create(&p[i].thread, NULL,
threaded_find_deltas, &p[i]);
if (ret)