[oe-commits] [bitbake] 08/17: prserv/serv: Send sentinel to stop handler thread

git at git.openembedded.org git at git.openembedded.org
Thu Aug 31 16:56:15 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

commit a7591ef34ce70ff1d7aa9362d7473e6f16fbd10f
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Thu Aug 31 17:20:15 2017 +0100

    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.
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/prserv/serv.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/prserv/serv.py b/lib/prserv/serv.py
index a2da072..6be78c8 100644
--- a/lib/prserv/serv.py
+++ b/lib/prserv/serv.py
@@ -84,6 +84,8 @@ class PRServer(SimpleXMLRPCServer):
             except queue.Empty:
                 self.table.sync_if_dirty()
                 continue
+            if request is None:
+                continue
             try:
                 self.finish_request(request, client_address)
                 self.shutdown_request(request)
@@ -103,7 +105,8 @@ class PRServer(SimpleXMLRPCServer):
     def sigterm_handler(self, signum, stack):
         if self.table:
             self.table.sync()
-        self.quit=True
+        self.quit()
+        self.requestqueue.put((None, None))
 
     def process_request(self, request, client_address):
         self.requestqueue.put((request, client_address))

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list