diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-11-29 16:51:18 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-12-05 13:11:27 +0000 |
commit | b9439e0255e4cf9b7fc8d8b034395bceb4f285f8 (patch) | |
tree | 07e999db5e67c6d9b373bbfa58216be9006f3f26 /bitbake/lib/bb/server/process.py | |
parent | f7060a43995279723036c37d173f846a3613180e (diff) | |
download | openembedded-core-contrib-b9439e0255e4cf9b7fc8d8b034395bceb4f285f8.tar.gz |
bitbake: server/process: Make lockfile handling clearer
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>
Diffstat (limited to 'bitbake/lib/bb/server/process.py')
-rw-r--r-- | bitbake/lib/bb/server/process.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index 81617acd96..d56681c5a9 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/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 |