eric7/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py

branch
eric7
changeset 8650
100726f55a9a
parent 8312
800c432b34c8
child 8881
54e42bc2437a
equal deleted inserted replaced
8649:01eb78cba360 8650:100726f55a9a
148 initialTasks = 2 * NumberOfProcesses 148 initialTasks = 2 * NumberOfProcesses
149 for task in argumentsList[:initialTasks]: 149 for task in argumentsList[:initialTasks]:
150 taskQueue.put(task) 150 taskQueue.put(task)
151 151
152 # Start worker processes 152 # Start worker processes
153 for _ in range(NumberOfProcesses): 153 workers = [
154 multiprocessing.Process( 154 multiprocessing.Process(
155 target=worker, args=(taskQueue, doneQueue) 155 target=workerTask, args=(taskQueue, doneQueue)
156 ).start() 156 ) for _ in range(NumberOfProcesses)
157 ]
158 for worker in workers:
159 worker.start()
157 160
158 # Get and send results 161 # Get and send results
159 endIndex = len(argumentsList) - initialTasks 162 endIndex = len(argumentsList) - initialTasks
160 for i in range(len(argumentsList)): 163 for i in range(len(argumentsList)):
161 resultSent = False 164 resultSent = False
181 taskQueue.put(argumentsList[i + initialTasks]) 184 taskQueue.put(argumentsList[i + initialTasks])
182 185
183 # Tell child processes to stop 186 # Tell child processes to stop
184 for _ in range(NumberOfProcesses): 187 for _ in range(NumberOfProcesses):
185 taskQueue.put('STOP') 188 taskQueue.put('STOP')
186 189
187 190 for worker in workers:
188 def worker(inputQueue, outputQueue): 191 worker.join()
192 worker.close()
193
194
195 def workerTask(inputQueue, outputQueue):
189 """ 196 """
190 Module function acting as the parallel worker for the syntax check. 197 Module function acting as the parallel worker for the syntax check.
191 198
192 @param inputQueue input queue (multiprocessing.Queue) 199 @param inputQueue input queue (multiprocessing.Queue)
193 @param outputQueue output queue (multiprocessing.Queue) 200 @param outputQueue output queue (multiprocessing.Queue)

eric ide

mercurial