bitbake: server/process: Make lockfile handling clearer

This simplifies the code and makes it easier to read but has the
same functionality.

(Bitbake rev: 21dcec291d58ab7ac5d2c07186c68e01d85e6f65)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2018-11-29 16:51:18 +00:00
parent 6ddeba54a4
commit feee885613

View 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