]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/build/build.py
BaseTools: Enable MAX_CONCURRENT_THREAD_NUMBER = 0 feature
[mirror_edk2.git] / BaseTools / Source / Python / build / build.py
index 38498046d7a29309e7e3085676aec917c7372ea1..de19756d99cba8bda49d33882c60a8081bbb6d0c 100644 (file)
@@ -2,7 +2,7 @@
 # build a platform or a module\r
 #\r
 #  Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>\r
-#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -26,6 +26,7 @@ import platform
 import traceback\r
 import encodings.ascii\r
 import itertools\r
+import multiprocessing\r
 \r
 from struct import *\r
 from threading import *\r
@@ -936,7 +937,10 @@ class Build():
                 self.ThreadNumber = int(self.ThreadNumber, 0)\r
 \r
         if self.ThreadNumber == 0:\r
-            self.ThreadNumber = 1\r
+            try:\r
+                self.ThreadNumber = multiprocessing.cpu_count()\r
+            except (ImportError, NotImplementedError):\r
+                self.ThreadNumber = 1\r
 \r
         if not self.PlatformFile:\r
             PlatformFile = self.TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_ACTIVE_PLATFORM]\r