diff options
Diffstat (limited to 'bitbake/lib/bb/server/process.py')
| -rw-r--r-- | bitbake/lib/bb/server/process.py | 12 |
1 files changed, 8 insertions, 4 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): |
