diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-11-29 16:51:18 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-02-25 22:19:58 +0000 |
commit | 21dcec291d58ab7ac5d2c07186c68e01d85e6f65 (patch) | |
tree | 1ee17dea118b1aa96d7a723655b46287124278c9 | |
parent | fd1504a5e92390b8e1c0e689b4c2cb0ac7096b1a (diff) | |
download | bitbake-contrib-21dcec291d58ab7ac5d2c07186c68e01d85e6f65.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>
-rw-r--r-- | lib/bb/server/process.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py index 0749b5bc3..a9302c558 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 |