summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/server/process.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/server/process.py')
-rw-r--r--bitbake/lib/bb/server/process.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index f4cb32c8aa..386294f580 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -87,8 +87,7 @@ class ProcessServer(Process, BaseImplServer):
87 self.featurelist = featurelist 87 self.featurelist = featurelist
88 self.quit = False 88 self.quit = False
89 89
90 self.keep_running = Event() 90 self.quitin, self.quitout = Pipe()
91 self.keep_running.set()
92 self.event_handle = multiprocessing.Value("i") 91 self.event_handle = multiprocessing.Value("i")
93 92
94 def run(self): 93 def run(self):
@@ -101,14 +100,18 @@ class ProcessServer(Process, BaseImplServer):
101 def main(self): 100 def main(self):
102 # Ignore SIGINT within the server, as all SIGINT handling is done by 101 # Ignore SIGINT within the server, as all SIGINT handling is done by
103 # the UI and communicated to us 102 # the UI and communicated to us
103 self.quitin.close()
104 signal.signal(signal.SIGINT, signal.SIG_IGN) 104 signal.signal(signal.SIGINT, signal.SIG_IGN)
105 while self.keep_running.is_set(): 105 while not self.quit:
106 try: 106 try:
107 if self.command_channel.poll(): 107 if self.command_channel.poll():
108 command = self.command_channel.recv() 108 command = self.command_channel.recv()
109 self.runCommand(command) 109 self.runCommand(command)
110 if self.quitout.poll():
111 self.quitout.recv()
112 self.quit = True
110 113
111 self.idle_commands(.1, [self.event_queue._reader, self.command_channel]) 114 self.idle_commands(.1, [self.event_queue._reader, self.command_channel, self.quitout])
112 except Exception: 115 except Exception:
113 logger.exception('Running command %s', command) 116 logger.exception('Running command %s', command)
114 117
@@ -147,7 +150,8 @@ class ProcessServer(Process, BaseImplServer):
147 self.command_channel.send(self.cooker.command.runCommand(command)) 150 self.command_channel.send(self.cooker.command.runCommand(command))
148 151
149 def stop(self): 152 def stop(self):
150 self.keep_running.clear() 153 self.quitin.send("quit")
154 self.quitin.close()
151 155
152class BitBakeProcessServerConnection(BitBakeBaseServerConnection): 156class BitBakeProcessServerConnection(BitBakeBaseServerConnection):
153 def __init__(self, serverImpl, ui_channel, event_queue): 157 def __init__(self, serverImpl, ui_channel, event_queue):