diff options
author | Nicolas Pitre <nico@cam.org> | 2007-09-10 08:40:44 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-09-10 10:49:11 -0700 |
commit | b81d9af71e1c6460511322c276b4b7ad7c86c444 (patch) | |
tree | e02c61196848f9fbd001c11ed94c2aa5337215b0 /builtin-pack-objects.c | |
parent | 367f4a4343d467ac76641362b102bc86da5cb584 (diff) | |
download | git-b81d9af71e1c6460511322c276b4b7ad7c86c444.tar.gz |
fix threaded delta search locking
Found by Jeff King.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r-- | builtin-pack-objects.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 42698d2948..af12e454e1 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -1597,6 +1597,7 @@ static void *threaded_find_deltas(void *arg) data_requester = me; pthread_mutex_unlock(&data_provider); pthread_mutex_lock(&data_ready); + pthread_mutex_unlock(&data_request); if (!me->list_size) return NULL; @@ -1609,7 +1610,7 @@ static void *threaded_find_deltas(void *arg) static void ll_find_deltas(struct object_entry **list, unsigned list_size, int window, int depth, unsigned *processed) { - struct thread_params p[delta_search_threads]; + struct thread_params *target, p[delta_search_threads]; int i, ret; unsigned chunk_size; @@ -1645,17 +1646,17 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size, sublist_size++; pthread_mutex_lock(&data_provider); - data_requester->list = list; - data_requester->list_size = sublist_size; + target = data_requester; + target->list = list; + target->list_size = sublist_size; pthread_mutex_unlock(&data_ready); list += sublist_size; list_size -= sublist_size; if (!sublist_size) { - pthread_join(data_requester->thread, NULL); + pthread_join(target->thread, NULL); i--; } - pthread_mutex_unlock(&data_request); } while (i); } |