]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
buildman: Allow builds to terminate cleanly
authorSimon Glass <sjg@chromium.org>
Sun, 18 Sep 2016 22:48:35 +0000 (16:48 -0600)
committersjg <sjg@chromium.org>
Sun, 9 Oct 2016 15:30:32 +0000 (09:30 -0600)
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>
tools/buildman/builder.py

index 384f053015e06f95778cda8c2a53a0f442d62349..44d1cfa5175dda6f14a56c73964752ef7434fad0 100644 (file)
@@ -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()