From 1d5f29a06d4a04c92b6086b0f4f3076bd6e105bd Mon Sep 17 00:00:00 2001 From: Mark Donszelmann Date: Wed, 18 Jul 2007 17:45:10 +0000 Subject: More fixes for NARPLUGIN-123 --- PATCHES | 2 +- src/net/sf/antcontrib/cpptasks/CCTask.java | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/PATCHES b/PATCHES index 009bd01..91ab611 100644 --- a/PATCHES +++ b/PATCHES @@ -18,7 +18,7 @@ ** Parallel running change - [src/net/sf/antcontrib/cpptasks/CCTask.java] fork of a process per core/cpu available. -- [src/net/sf/antcontrib/cpptasks/TargetHistoryTable.java] protect againts multi-threaded updates. +- [src/net/sf/antcontrib/cpptasks/TargetHistoryTable.java] protect against multi-threaded updates. - [src/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleCCompiler.java] replaced /Zi flag with /Z7 to disable writing debug database file (.pdb). ** -fno-rtti changes diff --git a/src/net/sf/antcontrib/cpptasks/CCTask.java b/src/net/sf/antcontrib/cpptasks/CCTask.java index d7a7b43..5375420 100644 --- a/src/net/sf/antcontrib/cpptasks/CCTask.java +++ b/src/net/sf/antcontrib/cpptasks/CCTask.java @@ -175,6 +175,8 @@ public class CCTask extends Task { return targetsByConfig; } +// FREEHEP + private int maxCores = 0; /** The compiler definitions. */ private Vector _compilers = new Vector(); /** The output file type. */ @@ -739,8 +741,10 @@ public class CCTask extends Task { // // BEGINFREEHEP -// int noOfCores = Runtime.getRuntime().availableProcessors(); -int noOfCores = 1; + int noOfCores = Runtime.getRuntime().availableProcessors(); + if (maxCores > 0) { + noOfCores = Math.min(maxCores, noOfCores); + } int noOfFiles = targetsForConfig.size(); if (noOfFiles < noOfCores) noOfCores = targetsForConfig.size(); @@ -1558,6 +1562,16 @@ int noOfCores = 1; public void setWarnings(WarningLevelEnum level) { compilerDef.setWarnings(level); } + +// BEGINFREEHEP + public void setMaxCores(int maxCores) { + this.maxCores = maxCores; + } + + public int getMaxCores() { + return maxCores; + } +// ENDFREEHEP /** * Indicates whether the build will continue even if there are compilation -- cgit v1.2.3