summaryrefslogtreecommitdiff
path: root/run-command.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-09-01 16:22:43 -0400
committerJunio C Hamano <gitster@pobox.com>2015-09-01 15:11:53 -0700
commit661a8cf408e83e4901bf09e2a48e9306622442dd (patch)
treef9bb2bd593d27765d0c23fe236ede6342e052f86 /run-command.h
parent323598387d900263c4980b43b8a96c43cdd7b6c7 (diff)
downloadgit-661a8cf408e83e4901bf09e2a48e9306622442dd.tar.gz
run-command: provide in_async query function
It's not easy for arbitrary code to find out whether it is running in an async process or not. A top-level function which is fed to start_async() can know (you just pass down an argument saying "you are async"). But that function may call other global functions, and we would not want to have to pass the information all the way through the call stack. Nor can we simply set a global variable, as those may be shared between async threads and the main thread (if the platform supports pthreads). We need pthread tricks _or_ a global variable, depending on how start_async is implemented. The callers don't have enough information to do this right, so let's provide a simple query function that does. Fortunately we can reuse the existing infrastructure to make the pthread case simple (and even simplify die_async() by using our new function). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'run-command.h')
-rw-r--r--run-command.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/run-command.h b/run-command.h
index 1103805af1..4aaac7ce0f 100644
--- a/run-command.h
+++ b/run-command.h
@@ -113,5 +113,6 @@ struct async {
int start_async(struct async *async);
int finish_async(struct async *async);
+int in_async(void);
#endif