]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
cooker: ensure that the cache sync completes
authorChris Larson <chris_larson@mentor.com>
Tue, 23 Nov 2010 17:46:49 +0000 (11:46 -0600)
committerChris Larson <chris_larson@mentor.com>
Tue, 23 Nov 2010 17:48:16 +0000 (10:48 -0700)
Without explicitly joining the thread, it's possible for the process to end
(e.g. after a bitbake -p) and kill off the thread without waiting for it to
exit cleanly.  So, register the thread join with atexit.

Signed-off-by: Chris Larson <chris_larson@mentor.com>
lib/bb/cooker.py

index db2d0d229900770b978e7619b44270b50f79de19..637d0b543517920e46d3f5b40bc6928f09a8d14a 100644 (file)
@@ -29,6 +29,7 @@ import sre_constants
 import threading
 import multiprocessing
 import signal
+import atexit
 from cStringIO import StringIO
 from contextlib import closing
 import bb
@@ -1003,7 +1004,9 @@ class CookerParser(object):
         self.task_queue.close()
         for process in self.processes:
             process.join()
-        threading.Thread(target=self.bb_cache.sync).start()
+        sync = threading.Thread(target=self.bb_cache.sync)
+        sync.start()
+        atexit.register(lambda: sync.join())
         if self.error > 0:
             raise ParsingErrorsFound()