diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-09 17:58:02 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-10 11:10:01 -0700 |
commit | efdc1598d24a0ca0eec5aa96bfed4d76107ec6b9 (patch) | |
tree | 353f370eea9601b6c4c2a42d2457188027c2be13 | |
parent | a445e03d8b89e900319a5d4f9477f9e3383f5be1 (diff) | |
download | ast2050-yocto-poky-efdc1598d24a0ca0eec5aa96bfed4d76107ec6b9.zip ast2050-yocto-poky-efdc1598d24a0ca0eec5aa96bfed4d76107ec6b9.tar.gz |
bitbake: server/process: Use a pipe for quit events instead of Event()
Its not possible to notice the change of status of an Event() in
the select call we sleep in. It would be possible in python 3.3 but
for now use a pipe instead. This removes small latency when bitbake
commands finish since the system doesn't sit in the select call.
(Debugging these kind of issues is apparent by setting a long sleep
for the select call)
(Bitbake rev: def28239b0f0d5f1cf13214b263114a5328538b7)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/server/process.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index f4cb32c..386294f 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py @@ -87,8 +87,7 @@ class ProcessServer(Process, BaseImplServer): self.featurelist = featurelist self.quit = False - self.keep_running = Event() - self.keep_running.set() + self.quitin, self.quitout = Pipe() self.event_handle = multiprocessing.Value("i") def run(self): @@ -101,14 +100,18 @@ class ProcessServer(Process, BaseImplServer): def main(self): # Ignore SIGINT within the server, as all SIGINT handling is done by # the UI and communicated to us + self.quitin.close() signal.signal(signal.SIGINT, signal.SIG_IGN) - while self.keep_running.is_set(): + while not self.quit: try: if self.command_channel.poll(): command = self.command_channel.recv() self.runCommand(command) + if self.quitout.poll(): + self.quitout.recv() + self.quit = True - self.idle_commands(.1, [self.event_queue._reader, self.command_channel]) + self.idle_commands(.1, [self.event_queue._reader, self.command_channel, self.quitout]) except Exception: logger.exception('Running command %s', command) @@ -147,7 +150,8 @@ class ProcessServer(Process, BaseImplServer): self.command_channel.send(self.cooker.command.runCommand(command)) def stop(self): - self.keep_running.clear() + self.quitin.send("quit") + self.quitin.close() class BitBakeProcessServerConnection(BitBakeBaseServerConnection): def __init__(self, serverImpl, ui_channel, event_queue): |