diff options
author | Feng, Bob C <bob.c.feng@intel.com> | 2019-07-30 18:04:14 +0800 |
---|---|---|
committer | Feng, Bob C <bob.c.feng@intel.com> | 2019-08-09 23:15:53 +0800 |
commit | 3285fbda88238596b2b7e886e67e455f0626bb1f (patch) | |
tree | 12c1a097402e24d4bf3500cb4906c1c06250aca8 /BaseTools | |
parent | 673d09a2ddfacbc8414ca703519f32c1e48ca5b7 (diff) | |
download | edk2-3285fbda88238596b2b7e886e67e455f0626bb1f.zip edk2-3285fbda88238596b2b7e886e67e455f0626bb1f.tar.gz edk2-3285fbda88238596b2b7e886e67e455f0626bb1f.tar.bz2 |
BaseTools: Add shared data for processes
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1875
Add shared data for autogen processes.
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools')
-rw-r--r-- | BaseTools/Source/Python/AutoGen/AutoGenWorker.py | 3 | ||||
-rw-r--r-- | BaseTools/Source/Python/build/build.py | 10 |
2 files changed, 8 insertions, 5 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGenWorker.py b/BaseTools/Source/Python/AutoGen/AutoGenWorker.py index 6c6ef49..9d06b45 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGenWorker.py +++ b/BaseTools/Source/Python/AutoGen/AutoGenWorker.py @@ -64,7 +64,7 @@ class AutoGenManager(threading.Thread): def kill(self):
self.feedback_q.put(None)
class AutoGenWorkerInProcess(mp.Process):
- def __init__(self,module_queue,data_pipe_file_path,feedback_q,file_lock,error_event):
+ def __init__(self,module_queue,data_pipe_file_path,feedback_q,file_lock, share_data,error_event):
mp.Process.__init__(self)
self.module_queue = module_queue
self.data_pipe_file_path =data_pipe_file_path
@@ -72,6 +72,7 @@ class AutoGenWorkerInProcess(mp.Process): self.feedback_q = feedback_q
self.PlatformMetaFileSet = {}
self.file_lock = file_lock
+ self.share_data = share_data
self.error_event = error_event
def GetPlatformMetaFile(self,filepath,root):
try:
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index af1be8d..b9305bf 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -52,6 +52,7 @@ from PatchPcdValue.PatchPcdValue import PatchBinaryFile import Common.GlobalData as GlobalData
from GenFds.GenFds import GenFds, GenFdsApi
import multiprocessing as mp
+from multiprocessing import Manager
# Version and Copyright
VersionNumber = "0.60" + ' ' + gBUILD_VERSION
@@ -828,14 +829,15 @@ class Build(): self.AutoGenMgr = None
EdkLogger.info("")
os.chdir(self.WorkspaceDir)
- def StartAutoGen(self,mqueue, DataPipe,SkipAutoGen,PcdMaList):
+ self.share_data = Manager().dict()
+ def StartAutoGen(self,mqueue, DataPipe,SkipAutoGen,PcdMaList,share_data):
try:
if SkipAutoGen:
return True,0
feedback_q = mp.Queue()
file_lock = mp.Lock()
error_event = mp.Event()
- auto_workers = [AutoGenWorkerInProcess(mqueue,DataPipe.dump_file,feedback_q,file_lock,error_event) for _ in range(self.ThreadNumber)]
+ auto_workers = [AutoGenWorkerInProcess(mqueue,DataPipe.dump_file,feedback_q,file_lock,share_data,error_event) for _ in range(self.ThreadNumber)]
self.AutoGenMgr = AutoGenManager(auto_workers,feedback_q,error_event)
self.AutoGenMgr.start()
for w in auto_workers:
@@ -1230,7 +1232,7 @@ class Build(): self.Progress.Start("Generating makefile and code")
data_pipe_file = os.path.join(AutoGenObject.BuildDir, "GlobalVar_%s_%s.bin" % (str(AutoGenObject.Guid),AutoGenObject.Arch))
AutoGenObject.DataPipe.dump(data_pipe_file)
- autogen_rt,errorcode = self.StartAutoGen(mqueue, AutoGenObject.DataPipe, self.SkipAutoGen, PcdMaList)
+ autogen_rt, errorcode = self.StartAutoGen(mqueue, AutoGenObject.DataPipe, self.SkipAutoGen, PcdMaList,self.share_data)
self.Progress.Stop("done!")
if not autogen_rt:
self.AutoGenMgr.TerminateWorkers()
@@ -2070,7 +2072,7 @@ class Build(): mqueue.put(m)
data_pipe_file = os.path.join(Pa.BuildDir, "GlobalVar_%s_%s.bin" % (str(Pa.Guid),Pa.Arch))
Pa.DataPipe.dump(data_pipe_file)
- autogen_rt, errorcode = self.StartAutoGen(mqueue, Pa.DataPipe, self.SkipAutoGen, PcdMaList)
+ autogen_rt, errorcode = self.StartAutoGen(mqueue, Pa.DataPipe, self.SkipAutoGen, PcdMaList,self.share_data)
self.Progress.Stop("done!")
self.AutoGenTime += int(round((time.time() - AutoGenStart)))
if not autogen_rt:
|