Plugins/CheckerPlugins/SyntaxChecker/jsCheckSyntax.py

changeset 5672
495b53f37f6c
parent 5588
6ba512d9f46a
child 5683
66b11f5171e8
equal deleted inserted replaced
5671:47cc72334684 5672:495b53f37f6c
11 from __future__ import unicode_literals 11 from __future__ import unicode_literals
12 12
13 import os 13 import os
14 import sys 14 import sys
15 import multiprocessing 15 import multiprocessing
16 import queue
16 17
17 18
18 def initService(): 19 def initService():
19 """ 20 """
20 Initialize the service and return the entry point. 21 Initialize the service and return the entry point.
106 .start() 107 .start()
107 108
108 # Get and send results 109 # Get and send results
109 endIndex = len(argumentsList) - initialTasks 110 endIndex = len(argumentsList) - initialTasks
110 for i in range(len(argumentsList)): 111 for i in range(len(argumentsList)):
111 filename, result = doneQueue.get() 112 resultSent = False
112 send(fx, filename, result) 113 wasCancelled = False
113 if cancelled(): 114
115 while not resultSent:
116 try:
117 # get result (waiting max. 3 seconds and send it to frontend
118 filename, result = doneQueue.get()
119 send(fx, filename, result)
120 resultSent = True
121 except queue.Empty:
122 # ignore empty queue, just carry on
123 if cancelled():
124 wasCancelled = True
125 break
126
127 if wasCancelled or cancelled():
114 # just exit the loop ignoring the results of queued tasks 128 # just exit the loop ignoring the results of queued tasks
115 break 129 break
130
116 if i < endIndex: 131 if i < endIndex:
117 taskQueue.put(argumentsList[i + initialTasks]) 132 taskQueue.put(argumentsList[i + initialTasks])
118 133
119 # Tell child processes to stop 134 # Tell child processes to stop
120 for i in range(NumberOfProcesses): 135 for i in range(NumberOfProcesses):

eric ide

mercurial