aboutsummaryrefslogtreecommitdiff
path: root/run-command.c
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2010-03-09 21:00:36 +0100
committerJunio C Hamano <gitster@pobox.com>2010-03-10 14:26:54 -0800
commitf6b6098316192475ff0b3fa2ba894d7e555bdfac (patch)
treef3fb95b975869ca5fea6006fdc70e23f814fcd3e /run-command.c
parent0ea1c89ba616397ef7e5f6f601ef7a24d2c27b8e (diff)
downloadgit-f6b6098316192475ff0b3fa2ba894d7e555bdfac.tar.gz
git-f6b6098316192475ff0b3fa2ba894d7e555bdfac.tar.xz
Enable threaded async procedures whenever pthreads is available
Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'run-command.c')
-rw-r--r--run-command.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/run-command.c b/run-command.c
index 66cc4bfa5..61b153987 100644
--- a/run-command.c
+++ b/run-command.c
@@ -447,7 +447,7 @@ int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const
return run_command(&cmd);
}
-#ifdef ASYNC_AS_THREAD
+#ifndef NO_PTHREADS
static pthread_t main_thread;
static int main_thread_set;
static pthread_key_t async_key;
@@ -455,10 +455,10 @@ static pthread_key_t async_key;
static void *run_thread(void *data)
{
struct async *async = data;
+ intptr_t ret;
pthread_setspecific(async_key, async);
-
- intptr_t ret = async->proc(async->proc_in, async->proc_out, async->data);
+ ret = async->proc(async->proc_in, async->proc_out, async->data);
return (void *)ret;
}
@@ -521,7 +521,7 @@ int start_async(struct async *async)
else
proc_out = -1;
-#ifndef ASYNC_AS_THREAD
+#ifdef NO_PTHREADS
/* Flush stdio before fork() to avoid cloning buffers */
fflush(NULL);
@@ -590,7 +590,7 @@ error:
int finish_async(struct async *async)
{
-#ifndef ASYNC_AS_THREAD
+#ifdef NO_PTHREADS
return wait_or_whine(async->pid, "child process", 0);
#else
void *ret = (void *)(intptr_t)(-1);