aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-29 16:51:18 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-05 13:09:13 +0000
commita0b9cfaf2d03fd047a79d32e668001718d02c4bf (patch)
tree019cc5bb130f6ba31844a9ce5a8288e938063a02 /lib
parent0cdc5b81fc1f5e5281a525a657e420ebc3bb9e90 (diff)
downloadbitbake-a0b9cfaf2d03fd047a79d32e668001718d02c4bf.tar.gz
server/process: Make lockfile handling clearer
This simplifies the code and makes it easier to read but has the same functionality. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/bb/server/process.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index 81617acd9..d56681c5a 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -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