summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2012-02-07 12:07:40 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-02-22 20:25:29 +0000
commit52ebd5ff1bc78b4d1e1b58011751e0658d6c2895 (patch)
treeb3864e31ba510319114496bb0937955240475fe5 /bitbake/lib/bb
parentcf60f95d9fc53828c1aa95198f24917aae2617e3 (diff)
downloadpoky-52ebd5ff1bc78b4d1e1b58011751e0658d6c2895.tar.gz
knotty: shut down more cleanly
This ensures that when we are shutting down, we drain the queue of events from the server. This ensures that the server never gets hung up on the join of the feeder thread associated with the event queue, thereby avoiding a bitbake hang issue. Also, since the third keyboard interrupt now behaves the same as the second, removed that message. (Bitbake rev: ce9e0946b8a412616074809c76fba54f8bff36c4) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/ui/knotty.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index e1d42f7871..22370efc60 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -118,6 +118,8 @@ def main(server, eventHandler):
118 try: 118 try:
119 event = eventHandler.waitEvent(0.25) 119 event = eventHandler.waitEvent(0.25)
120 if event is None: 120 if event is None:
121 if shutdown > 1:
122 break
121 continue 123 continue
122 helper.eventHandler(event) 124 helper.eventHandler(event)
123 if isinstance(event, bb.runqueue.runQueueExitWait): 125 if isinstance(event, bb.runqueue.runQueueExitWait):
@@ -199,18 +201,18 @@ def main(server, eventHandler):
199 print("Loaded %d entries from dependency cache." % event.num_entries) 201 print("Loaded %d entries from dependency cache." % event.num_entries)
200 continue 202 continue
201 203
202 if isinstance(event, bb.command.CommandCompleted):
203 break
204 if isinstance(event, bb.command.CommandFailed): 204 if isinstance(event, bb.command.CommandFailed):
205 return_value = event.exitcode 205 return_value = event.exitcode
206 logger.error("Command execution failed: %s", event.error) 206 logger.error("Command execution failed: %s", event.error)
207 break 207 shutdown = 2
208 continue
208 if isinstance(event, bb.command.CommandExit): 209 if isinstance(event, bb.command.CommandExit):
209 if not return_value: 210 if not return_value:
210 return_value = event.exitcode 211 return_value = event.exitcode
211 continue 212 continue
212 if isinstance(event, bb.cooker.CookerExit): 213 if isinstance(event, (bb.command.CommandCompleted, bb.cooker.CookerExit)):
213 break 214 shutdown = 2
215 continue
214 if isinstance(event, bb.event.MultipleProviders): 216 if isinstance(event, bb.event.MultipleProviders):
215 logger.info("multiple providers are available for %s%s (%s)", event._is_runtime and "runtime " or "", 217 logger.info("multiple providers are available for %s%s (%s)", event._is_runtime and "runtime " or "",
216 event._item, 218 event._item,
@@ -269,9 +271,6 @@ def main(server, eventHandler):
269 if ioerror.args[0] == 4: 271 if ioerror.args[0] == 4:
270 pass 272 pass
271 except KeyboardInterrupt: 273 except KeyboardInterrupt:
272 if shutdown == 2:
273 print("\nThird Keyboard Interrupt, exit.\n")
274 break
275 if shutdown == 1: 274 if shutdown == 1:
276 print("\nSecond Keyboard Interrupt, stopping...\n") 275 print("\nSecond Keyboard Interrupt, stopping...\n")
277 server.runCommand(["stateStop"]) 276 server.runCommand(["stateStop"])