Skip to content

Commit

Permalink
buildman: Allow builds to terminate cleanly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
sjg20 committed Oct 9, 2016
1 parent a556eee commit d436e38
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/buildman/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import shutil
import string
import sys
import threading
import time

import builderthread
Expand Down Expand Up @@ -1443,8 +1444,11 @@ def BuildBoards(self, commits, board_selected, keep_outputs, verbose):
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()
Expand Down

0 comments on commit d436e38

Please sign in to comment.