From e0e21283b60da5d5d9d5f95f9f2a73189fa978f1 Mon Sep 17 00:00:00 2001 From: Etienne Buira Date: Sat, 11 Oct 2014 16:42:07 +0200 Subject: index-pack: fix compilation with NO_PTHREADS type_cas_lock/unlock() should be defined as no-op for NO_PTHREADS build, just like all the other locking primitives. Signed-off-by: Etienne Buira Signed-off-by: Junio C Hamano --- builtin/index-pack.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'builtin') diff --git a/builtin/index-pack.c b/builtin/index-pack.c index 792c66ca59..a369f55353 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -185,6 +185,9 @@ static void cleanup_thread(void) #define deepest_delta_lock() #define deepest_delta_unlock() +#define type_cas_lock() +#define type_cas_unlock() + #endif -- cgit v1.2.1 From 0c45d258ec35c1ef51523dd45e4518bd8a09258c Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 13 Oct 2014 12:46:14 -0700 Subject: pack-objects: set number of threads before checking and warning Under NO_PTHREADS build, we warn when delta_search_threads is not set to 1, because that is the only sensible value on a single threaded build. However, the auto detection that kicks in when that variable is set to 0 (e.g. there is no configuration variable or command line option, or an explicit --threads=0 is given from the command line to override the pack.threads configuration to force auto-detection) was not done before the condition to issue this warning was tested. Move the auto-detection code and place it at an appropriate spot. Signed-off-by: Junio C Hamano --- builtin/pack-objects.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'builtin') diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index d39193453a..a71523706a 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1972,8 +1972,6 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size, init_threaded_search(); - if (!delta_search_threads) /* --threads=0 means autodetect */ - delta_search_threads = online_cpus(); if (delta_search_threads <= 1) { find_deltas(list, &list_size, window, depth, processed); cleanup_threaded_search(); @@ -2685,6 +2683,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) pack_compression_level = Z_DEFAULT_COMPRESSION; else if (pack_compression_level < 0 || pack_compression_level > Z_BEST_COMPRESSION) die("bad pack compression level %d", pack_compression_level); + + if (!delta_search_threads) /* --threads=0 means autodetect */ + delta_search_threads = online_cpus(); + #ifdef NO_PTHREADS if (delta_search_threads != 1) warning("no threads support, ignoring --threads"); -- cgit v1.2.1 From 0f4b6db3baeff8de53769b38f439408abd5a42f7 Mon Sep 17 00:00:00 2001 From: Etienne Buira Date: Sat, 18 Oct 2014 14:31:15 +0200 Subject: Handle atexit list internaly for unthreaded builds Wrap atexit()s calls on unthreaded builds to handle callback list internally. This is needed because on unthreaded builds, asyncs inherits parent's atexit() list, that gets run as soon as the async exit()s (and again at the end of async's parent process). That led to remove temporary files too early. Also remove a by-atexit-callback guard against this kind of issue in clone.c, as this patch makes it redundant. Fixes test 5537 (temporary shallow file vanished before unpack-objects could open it) BTW remove an unused variable in shallow.c. Helped-by: Duy Nguyen Helped-by: Andreas Schwab Helped-by: Junio C Hamano Signed-off-by: Etienne Buira Signed-off-by: Junio C Hamano --- builtin/clone.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'builtin') diff --git a/builtin/clone.c b/builtin/clone.c index 3927edfb6e..4340477925 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -390,7 +390,6 @@ static void clone_local(const char *src_repo, const char *dest_repo) static const char *junk_work_tree; static const char *junk_git_dir; -static pid_t junk_pid; static enum { JUNK_LEAVE_NONE, JUNK_LEAVE_REPO, @@ -417,8 +416,6 @@ static void remove_junk(void) break; } - if (getpid() != junk_pid) - return; if (junk_git_dir) { strbuf_addstr(&sb, junk_git_dir); remove_dir_recursively(&sb, 0); @@ -759,8 +756,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix) struct refspec *refspec; const char *fetch_pattern; - junk_pid = getpid(); - packet_trace_identity("clone"); argc = parse_options(argc, argv, prefix, builtin_clone_options, builtin_clone_usage, 0); -- cgit v1.2.1