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:27:46 +0000 |
commit | feee885613d1a3e1184b0fab4f3e24d1c5c3fee8 (patch) | |
tree | fc6c6c610ec81b1da7f8621adb8b29f336e6c1bd /bitbake | |
parent | 6ddeba54a48edc02174a93fe654d4778a3218038 (diff) | |
download | poky-feee885613d1a3e1184b0fab4f3e24d1c5c3fee8.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: 21dcec291d58ab7ac5d2c07186c68e01d85e6f65)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-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 0749b5bc3e..a9302c5588 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py | |||
@@ -239,6 +239,12 @@ class ProcessServer(multiprocessing.Process): | |||
239 | while not lock: | 239 | while not lock: |
240 | with bb.utils.timeout(3): | 240 | with bb.utils.timeout(3): |
241 | lock = bb.utils.lockfile(lockfile, shared=False, retry=False, block=True) | 241 | lock = bb.utils.lockfile(lockfile, shared=False, retry=False, block=True) |
242 | if lock: | ||
243 | # We hold the lock so we can remove the file (hide stale pid data) | ||
244 | bb.utils.remove(lockfile) | ||
245 | bb.utils.unlockfile(lock) | ||
246 | return | ||
247 | |||
242 | if not lock: | 248 | if not lock: |
243 | # Some systems may not have lsof available | 249 | # Some systems may not have lsof available |
244 | procs = None | 250 | procs = None |
@@ -259,10 +265,6 @@ class ProcessServer(multiprocessing.Process): | |||
259 | if procs: | 265 | if procs: |
260 | msg += ":\n%s" % str(procs) | 266 | msg += ":\n%s" % str(procs) |
261 | print(msg) | 267 | print(msg) |
262 | return | ||
263 | # We hold the lock so we can remove the file (hide stale pid data) | ||
264 | bb.utils.remove(lockfile) | ||
265 | bb.utils.unlockfile(lock) | ||
266 | 268 | ||
267 | def idle_commands(self, delay, fds=None): | 269 | def idle_commands(self, delay, fds=None): |
268 | nextsleep = delay | 270 | nextsleep = delay |