Explorar o código

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>
Simon Glass %!s(int64=8) %!d(string=hai) anos
pai
achega
d436e38189
Modificáronse 1 ficheiros con 6 adicións e 2 borrados
  1. 6 2
      tools/buildman/builder.py

+ 6 - 2
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()