summaryrefslogtreecommitdiff
path: root/builtin-pack-objects.c
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2010-05-08 17:13:49 +0200
committerJunio C Hamano <gitster@pobox.com>2010-05-08 22:27:54 -0700
commit851c34b04e0ce866e15c28e144986eca7533a6f4 (patch)
treef0c79c6963ecc08c4ab1d76a08156bcd2bfc39f5 /builtin-pack-objects.c
parent937491944292fa3303b565b9bd8914c6b644ab13 (diff)
downloadgit-851c34b04e0ce866e15c28e144986eca7533a6f4.tar.gz
Have set_try_to_free_routine return the previous routine
This effectively requires from the callers of set_try_to_free_routine to treat the try-to-free-routines as a stack. We will need this for the next patch where the only current caller cannot depend on that the previously set routine was the default routine. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r--builtin-pack-objects.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 26fc7cd5a6..5279cd99f2 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1556,6 +1556,8 @@ static void try_to_free_from_threads(size_t size)
read_unlock();
}
+try_to_free_t old_try_to_free_routine;
+
/*
* The main thread waits on the condition that (at least) one of the workers
* has stopped working (which is indicated in the .working member of
@@ -1590,12 +1592,12 @@ static void init_threaded_search(void)
pthread_mutex_init(&cache_mutex, NULL);
pthread_mutex_init(&progress_mutex, NULL);
pthread_cond_init(&progress_cond, NULL);
- set_try_to_free_routine(try_to_free_from_threads);
+ old_try_to_free_routine = set_try_to_free_routine(try_to_free_from_threads);
}
static void cleanup_threaded_search(void)
{
- set_try_to_free_routine(NULL);
+ set_try_to_free_routine(old_try_to_free_routine);
pthread_cond_destroy(&progress_cond);
pthread_mutex_destroy(&read_mutex);
pthread_mutex_destroy(&cache_mutex);