summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-12-04 16:58:08 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-12-04 18:02:01 +0000
commit7e1e4aeea2faa3ca2ebb8cb564e54008479847a2 (patch)
tree023c134a5c86bdb4b42893ad917b8d5abb2fbc8e /bitbake/lib/bb/ui
parente77f0570e8728320d08afa5c37013086632303e8 (diff)
downloadpoky-7e1e4aeea2faa3ca2ebb8cb564e54008479847a2.tar.gz
bitbake: uievent: Fix an init race
There is a race where the registerEventHandler() server call may happen in a different thread to the main UI, causing the main UI to see httplib.CannotSendRequest exceptions. This moves the call into the main thread, removing the init race and fixing errors I was seeing with the xmlrpc backend. (Bitbake rev: 14cdd3b351d1ab23cb3ea5f853e403a53e67ac1c) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui')
-rw-r--r--bitbake/lib/bb/ui/uievent.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py
index 28817a22f7..0b9a836d0f 100644
--- a/bitbake/lib/bb/ui/uievent.py
+++ b/bitbake/lib/bb/ui/uievent.py
@@ -37,6 +37,17 @@ class BBUIEventQueue:
37 self.BBServer = BBServer 37 self.BBServer = BBServer
38 self.clientinfo = clientinfo 38 self.clientinfo = clientinfo
39 39
40 server = UIXMLRPCServer(self.clientinfo)
41 self.host, self.port = server.socket.getsockname()
42
43 server.register_function( self.system_quit, "event.quit" )
44 server.register_function( self.send_event, "event.sendpickle" )
45 server.socket.settimeout(1)
46
47 self.EventHandle = self.BBServer.registerEventHandler(self.host, self.port)
48
49 self.server = server
50
40 self.t = threading.Thread() 51 self.t = threading.Thread()
41 self.t.setDaemon(True) 52 self.t.setDaemon(True)
42 self.t.run = self.startCallbackHandler 53 self.t.run = self.startCallbackHandler
@@ -73,19 +84,9 @@ class BBUIEventQueue:
73 84
74 def startCallbackHandler(self): 85 def startCallbackHandler(self):
75 86
76 server = UIXMLRPCServer(self.clientinfo) 87 while not self.server.quit:
77 self.host, self.port = server.socket.getsockname() 88 self.server.handle_request()
78 89 self.server.server_close()
79 server.register_function( self.system_quit, "event.quit" )
80 server.register_function( self.send_event, "event.sendpickle" )
81 server.socket.settimeout(1)
82
83 self.EventHandle = self.BBServer.registerEventHandler(self.host, self.port)
84
85 self.server = server
86 while not server.quit:
87 server.handle_request()
88 server.server_close()
89 90
90 def system_quit( self ): 91 def system_quit( self ):
91 """ 92 """