summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Björklund <anders@itension.se>2015-11-20 20:18:21 +0100
committerShawn Landden <slandden@gmail.com>2018-02-26 15:27:30 -0800
commited1d86ecb62d775ce8bae0f2548c16a529f15979 (patch)
treefec70ff4ee73aa7b0b228c212a2ddf75403ba699
parent3f510877feb4f66a3674bc1b8d2b1fbb96232d9b (diff)
downloaddistcc-git-ed1d86ecb62d775ce8bae0f2548c16a529f15979.tar.gz
Avoid locking the CPU for preprocessed input
It is not needed to (possibly having to first wait for and then) take a lock on localslots_cpp for preprocessed input (such as emitted by ccache). We are not going to start the preprocessor, and will not try to preprocess remotely with pump. So the preprocessor lock taken will be unnecessary anyway.
-rw-r--r--src/compile.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/compile.c b/src/compile.c
index dc458fb..b1d2fd9 100644
--- a/src/compile.c
+++ b/src/compile.c
@@ -732,10 +732,12 @@ dcc_build_somewhere(char *argv[],
goto run_local;
}
- /* Lock the local CPU, since we're going to be doing preprocessing
- * or include scanning. */
- if ((ret = dcc_lock_local_cpp(&local_cpu_lock_fd)) != 0) {
- goto fallback;
+ if (!dcc_is_preprocessed(input_fname)) {
+ /* Lock the local CPU, since we're going to be doing preprocessing
+ * or include scanning. */
+ if ((ret = dcc_lock_local_cpp(&local_cpu_lock_fd)) != 0) {
+ goto fallback;
+ }
}
if (host->cpp_where == DCC_CPP_ON_SERVER) {
@@ -766,7 +768,7 @@ dcc_build_somewhere(char *argv[],
dcc_get_protover_from_features(host->compr,
host->cpp_where,
&host->protover);
- } else {
+ } else if (local_cpu_lock_fd != -1) {
/* Include server succeeded. */
/* We're done with local "preprocessing" (include scanning). */
dcc_unlock(local_cpu_lock_fd);