]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: server/process: Make lockfile handling clearer
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 29 Nov 2018 16:51:18 +0000 (16:51 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 5 Dec 2018 13:11:27 +0000 (13:11 +0000)
This simplifies the code and makes it easier to read but has the
same functionality.

(Bitbake rev: a0b9cfaf2d03fd047a79d32e668001718d02c4bf)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/server/process.py

index 81617acd96160014a2cf375af5adaf66ef9a344a..d56681c5a97b5c0f460f84a4f10ef360505ebc49 100644 (file)
@@ -239,6 +239,12 @@ class ProcessServer(multiprocessing.Process):
         while not lock:
             with bb.utils.timeout(3):
                 lock = bb.utils.lockfile(lockfile, shared=False, retry=False, block=True)
+                if lock:
+                    # We hold the lock so we can remove the file (hide stale pid data)
+                    bb.utils.remove(lockfile)
+                    bb.utils.unlockfile(lock)
+                    return
+
                 if not lock:
                     # Some systems may not have lsof available
                     procs = None
@@ -259,10 +265,6 @@ class ProcessServer(multiprocessing.Process):
                     if procs:
                         msg += ":\n%s" % str(procs)
                     print(msg)
-                    return
-        # We hold the lock so we can remove the file (hide stale pid data)
-        bb.utils.remove(lockfile)
-        bb.utils.unlockfile(lock)
 
     def idle_commands(self, delay, fds=None):
         nextsleep = delay