mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 00:39:46 +00:00
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>
This commit is contained in:
@@ -239,6 +239,12 @@ class ProcessServer(multiprocessing.Process):
|
|||||||
while not lock:
|
while not lock:
|
||||||
with bb.utils.timeout(3):
|
with bb.utils.timeout(3):
|
||||||
lock = bb.utils.lockfile(lockfile, shared=False, retry=False, block=True)
|
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:
|
if not lock:
|
||||||
# Some systems may not have lsof available
|
# Some systems may not have lsof available
|
||||||
procs = None
|
procs = None
|
||||||
@@ -259,10 +265,6 @@ class ProcessServer(multiprocessing.Process):
|
|||||||
if procs:
|
if procs:
|
||||||
msg += ":\n%s" % str(procs)
|
msg += ":\n%s" % str(procs)
|
||||||
print(msg)
|
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):
|
def idle_commands(self, delay, fds=None):
|
||||||
nextsleep = delay
|
nextsleep = delay
|
||||||
|
|||||||
Reference in New Issue
Block a user