diff options
Diffstat (limited to 'bitbake/lib/bb/server')
-rw-r--r-- | bitbake/lib/bb/server/process.py | 12 | ||||
-rw-r--r-- | bitbake/lib/bb/server/xmlrpc.py | 6 |
2 files changed, 13 insertions, 5 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index 99a6bf55cc..e2cec49b74 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py | |||
@@ -37,8 +37,9 @@ from . import BitBakeBaseServer, BitBakeBaseServerConnection, BaseImplServer | |||
37 | logger = logging.getLogger('BitBake') | 37 | logger = logging.getLogger('BitBake') |
38 | 38 | ||
39 | class ServerCommunicator(): | 39 | class ServerCommunicator(): |
40 | def __init__(self, connection): | 40 | def __init__(self, connection, event_handle): |
41 | self.connection = connection | 41 | self.connection = connection |
42 | self.event_handle = event_handle | ||
42 | 43 | ||
43 | def runCommand(self, command): | 44 | def runCommand(self, command): |
44 | # @todo try/except | 45 | # @todo try/except |
@@ -54,6 +55,8 @@ class ServerCommunicator(): | |||
54 | except KeyboardInterrupt: | 55 | except KeyboardInterrupt: |
55 | pass | 56 | pass |
56 | 57 | ||
58 | def getEventHandle(self): | ||
59 | return self.event_handle.value | ||
57 | 60 | ||
58 | class EventAdapter(): | 61 | class EventAdapter(): |
59 | """ | 62 | """ |
@@ -84,11 +87,12 @@ class ProcessServer(Process, BaseImplServer): | |||
84 | 87 | ||
85 | self.keep_running = Event() | 88 | self.keep_running = Event() |
86 | self.keep_running.set() | 89 | self.keep_running.set() |
90 | self.event_handle = multiprocessing.Value("i") | ||
87 | 91 | ||
88 | def run(self): | 92 | def run(self): |
89 | for event in bb.event.ui_queue: | 93 | for event in bb.event.ui_queue: |
90 | self.event_queue.put(event) | 94 | self.event_queue.put(event) |
91 | self.event_handle = bb.event.register_UIHhandler(self) | 95 | self.event_handle.value = bb.event.register_UIHhandler(self) |
92 | bb.cooker.server_main(self.cooker, self.main) | 96 | bb.cooker.server_main(self.cooker, self.main) |
93 | 97 | ||
94 | def main(self): | 98 | def main(self): |
@@ -106,7 +110,7 @@ class ProcessServer(Process, BaseImplServer): | |||
106 | logger.exception('Running command %s', command) | 110 | logger.exception('Running command %s', command) |
107 | 111 | ||
108 | self.event_queue.close() | 112 | self.event_queue.close() |
109 | bb.event.unregister_UIHhandler(self.event_handle) | 113 | bb.event.unregister_UIHhandler(self.event_handle.value) |
110 | self.command_channel.close() | 114 | self.command_channel.close() |
111 | self.cooker.stop() | 115 | self.cooker.stop() |
112 | self.idle_commands(.1) | 116 | self.idle_commands(.1) |
@@ -147,7 +151,7 @@ class BitBakeProcessServerConnection(BitBakeBaseServerConnection): | |||
147 | self.procserver = serverImpl | 151 | self.procserver = serverImpl |
148 | self.ui_channel = ui_channel | 152 | self.ui_channel = ui_channel |
149 | self.event_queue = event_queue | 153 | self.event_queue = event_queue |
150 | self.connection = ServerCommunicator(self.ui_channel) | 154 | self.connection = ServerCommunicator(self.ui_channel, self.procserver.event_handle) |
151 | self.events = self.event_queue | 155 | self.events = self.event_queue |
152 | 156 | ||
153 | def terminate(self): | 157 | def terminate(self): |
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py index d290550e9f..4dee5d9fea 100644 --- a/bitbake/lib/bb/server/xmlrpc.py +++ b/bitbake/lib/bb/server/xmlrpc.py | |||
@@ -95,7 +95,8 @@ class BitBakeServerCommands(): | |||
95 | """ | 95 | """ |
96 | s, t = _create_server(host, port) | 96 | s, t = _create_server(host, port) |
97 | 97 | ||
98 | return bb.event.register_UIHhandler(s) | 98 | self.event_handle = bb.event.register_UIHhandler(s) |
99 | return self.event_handle | ||
99 | 100 | ||
100 | def unregisterEventHandler(self, handlerNum): | 101 | def unregisterEventHandler(self, handlerNum): |
101 | """ | 102 | """ |
@@ -109,6 +110,9 @@ class BitBakeServerCommands(): | |||
109 | """ | 110 | """ |
110 | return self.cooker.command.runCommand(command, self.server.readonly) | 111 | return self.cooker.command.runCommand(command, self.server.readonly) |
111 | 112 | ||
113 | def getEventHandle(self): | ||
114 | return self.event_handle | ||
115 | |||
112 | def terminateServer(self): | 116 | def terminateServer(self): |
113 | """ | 117 | """ |
114 | Trigger the server to quit | 118 | Trigger the server to quit |