summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r--bitbake/lib/bb/utils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index ccafda19e3..82e5dc4277 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -402,7 +402,7 @@ def fileslocked(files):
402 for lock in locks: 402 for lock in locks:
403 bb.utils.unlockfile(lock) 403 bb.utils.unlockfile(lock)
404 404
405def lockfile(name, shared=False): 405def lockfile(name, shared=False, retry=True):
406 """ 406 """
407 Use the file fn as a lock file, return when the lock has been acquired. 407 Use the file fn as a lock file, return when the lock has been acquired.
408 Returns a variable to pass to unlockfile(). 408 Returns a variable to pass to unlockfile().
@@ -418,6 +418,8 @@ def lockfile(name, shared=False):
418 op = fcntl.LOCK_EX 418 op = fcntl.LOCK_EX
419 if shared: 419 if shared:
420 op = fcntl.LOCK_SH 420 op = fcntl.LOCK_SH
421 if not retry:
422 op = op | fcntl.LOCK_NB
421 423
422 while True: 424 while True:
423 # If we leave the lockfiles lying around there is no problem 425 # If we leave the lockfiles lying around there is no problem
@@ -442,6 +444,8 @@ def lockfile(name, shared=False):
442 lf.close() 444 lf.close()
443 except Exception: 445 except Exception:
444 continue 446 continue
447 if not retry:
448 return None
445 449
446def unlockfile(lf): 450def unlockfile(lf):
447 """ 451 """