summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-31 17:20:15 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-31 23:30:03 +0100
commit93a54f3432752646d53439210de6769368fb466e (patch)
treea5705e8d9663366f19d395e6958ac296499abe0a
parent260a22b241b81241c9edff2643f03fc3a31df38b (diff)
downloadpoky-93a54f3432752646d53439210de6769368fb466e.tar.gz
bitbake: prserv/serv: Send sentinel to stop handler thread
Shutdown from SIGTERM currently has to wait for the handler thread to timeout. Add a sentinel value which triggers it to loop and allows for a quick exit. (Bitbake rev: a7591ef34ce70ff1d7aa9362d7473e6f16fbd10f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/prserv/serv.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/bitbake/lib/prserv/serv.py b/bitbake/lib/prserv/serv.py
index a2da07227f..6be78c82fb 100644
--- a/bitbake/lib/prserv/serv.py
+++ b/bitbake/lib/prserv/serv.py
@@ -84,6 +84,8 @@ class PRServer(SimpleXMLRPCServer):
84 except queue.Empty: 84 except queue.Empty:
85 self.table.sync_if_dirty() 85 self.table.sync_if_dirty()
86 continue 86 continue
87 if request is None:
88 continue
87 try: 89 try:
88 self.finish_request(request, client_address) 90 self.finish_request(request, client_address)
89 self.shutdown_request(request) 91 self.shutdown_request(request)
@@ -103,7 +105,8 @@ class PRServer(SimpleXMLRPCServer):
103 def sigterm_handler(self, signum, stack): 105 def sigterm_handler(self, signum, stack):
104 if self.table: 106 if self.table:
105 self.table.sync() 107 self.table.sync()
106 self.quit=True 108 self.quit()
109 self.requestqueue.put((None, None))
107 110
108 def process_request(self, request, client_address): 111 def process_request(self, request, client_address):
109 self.requestqueue.put((request, client_address)) 112 self.requestqueue.put((request, client_address))