diff options
author | Richard Purdie <richard@openedhand.com> | 2008-10-06 08:09:11 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2008-10-06 08:09:11 +0000 |
commit | f4337b98030c00bf53ea8cd88ea51a2f091e4ed3 (patch) | |
tree | 0a57cf013048d793d678311ca3e3cb98351a4cdc /bitbake-dev | |
parent | 527b3372cdafc988c581f946d79de6f57f0e3cd4 (diff) | |
download | openembedded-core-f4337b98030c00bf53ea8cd88ea51a2f091e4ed3.tar.gz openembedded-core-f4337b98030c00bf53ea8cd88ea51a2f091e4ed3.tar.bz2 openembedded-core-f4337b98030c00bf53ea8cd88ea51a2f091e4ed3.zip |
bitbake utils.py: Fix ocassional locking glitch with a better retrying mechanism
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5415 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake-dev')
-rw-r--r-- | bitbake-dev/lib/bb/utils.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/bitbake-dev/lib/bb/utils.py b/bitbake-dev/lib/bb/utils.py index 89506649fb..119f08582d 100644 --- a/bitbake-dev/lib/bb/utils.py +++ b/bitbake-dev/lib/bb/utils.py @@ -246,15 +246,18 @@ def lockfile(name): # This implementation is unfair since the last person to request the # lock is the most likely to win it. - lf = open(name, "a+") - fcntl.flock(lf.fileno(), fcntl.LOCK_EX) - statinfo = os.fstat(lf.fileno()) - if os.path.exists(lf.name): - statinfo2 = os.stat(lf.name) - if statinfo.st_ino == statinfo2.st_ino: - return lf - # File no longer exists or changed, retry - lf.close + try: + lf = open(name, "a+") + fcntl.flock(lf.fileno(), fcntl.LOCK_EX) + statinfo = os.fstat(lf.fileno()) + if os.path.exists(lf.name): + statinfo2 = os.stat(lf.name) + if statinfo.st_ino == statinfo2.st_ino: + return lf + # File no longer exists or changed, retry + lf.close + except Exception, e: + continue def unlockfile(lf): """ |