From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: [PATCH] server/process: Use a pipe for quit events instead of Event()
Date: Sun, 09 Mar 2014 17:58:02 -0700 [thread overview]
Message-ID: <1394413082.7883.19.camel@ted> (raw)
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)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
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):
reply other threads:[~2014-03-10 0:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394413082.7883.19.camel@ted \
--to=richard.purdie@linuxfoundation.org \
--cc=bitbake-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.