summaryrefslogtreecommitdiff
path: root/tools/buildman
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-09-18 16:48:35 -0600
committersjg <sjg@chromium.org>2016-10-09 09:30:32 -0600
commitd436e38189a26227274a3014d3d838eb3f183488 (patch)
tree84ad810469f774cb92dd7c4e81ec961df7b36e57 /tools/buildman
parenta556eeebaada39d0d53941b4d18e5b6ea338c2cf (diff)
downloadu-boot-imx-d436e38189a26227274a3014d3d838eb3f183488.zip
u-boot-imx-d436e38189a26227274a3014d3d838eb3f183488.tar.gz
u-boot-imx-d436e38189a26227274a3014d3d838eb3f183488.tar.bz2
buildman: Allow builds to terminate cleanly
It is annoying that buildman does not respond cleanly to Ctrl-C or SIGINT, particularly on machines with lots of CPUS. Unfortunately queue.join() blocks the main thread and does not allow it to see the signal. Use a separate thread instead, Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/buildman')
-rw-r--r--tools/buildman/builder.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 384f053..44d1cfa 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -14,6 +14,7 @@ import Queue
import shutil
import string
import sys
+import threading
import time
import builderthread
@@ -1443,8 +1444,11 @@ class Builder:
job.step = self._step
self.queue.put(job)
- # Wait until all jobs are started
- self.queue.join()
+ term = threading.Thread(target=self.queue.join)
+ term.setDaemon(True)
+ term.start()
+ while term.isAlive():
+ term.join(100)
# Wait until we have processed all output
self.out_queue.join()