]> code.ossystems Code Review - openembedded-core.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)
committerRichard Purdie <rpurdie@linux.intel.com>
Tue, 4 Jan 2011 14:46:44 +0000 (14:46 +0000)
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.

(Bitbake rev: 97ce57e6f860d3e6f34cc7a603ed1eeac4f423d3)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
bitbake/lib/bb/cooker.py

index 69098ccf91785fa4ced92e8a0459fa3e1a4538aa..0ed70f9bd8b908ca5ae9cd442dbe3d77d1fa9678 100644 (file)
@@ -28,6 +28,7 @@ import sre_constants
 import threading
 import multiprocessing
 import signal
+import atexit
 from cStringIO import StringIO
 from contextlib import closing
 import bb
@@ -1038,8 +1039,12 @@ class CookerParser(object):
         self.task_queue.close()
         for process in self.processes:
             process.join()
-        threading.Thread(target=self.bb_cache.sync).start()
-        threading.Thread(target=bb.codeparser.parser_cache_save(self.cooker.configuration.data)).start()
+        sync = threading.Thread(target=self.bb_cache.sync)
+        sync.start()
+        atexit.register(lambda: sync.join())
+        codesync = threading.Thread(target=bb.codeparser.parser_cache_save(self.cooker.configuration.data))
+        codesync.start()
+        atexit.register(lambda: codesync.join())
         if self.error > 0:
             raise ParsingErrorsFound()