From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/util/_dyn_libs/
Date: Sat, 7 May 2011 17:25:40 +0000 (UTC) [thread overview]
Message-ID: <48e1b835df5fefe49e2227e37c007d87fade1c55.zmedico@gentoo> (raw)
commit: 48e1b835df5fefe49e2227e37c007d87fade1c55
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat May 7 17:25:20 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat May 7 17:25:20 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=48e1b835
PreserveLibsRegistry: add lock/unlock assertions
Also, add comments to store() about unobvious interaction with
locking due to atomic replacement of the inode.
---
.../util/_dyn_libs/PreservedLibsRegistry.py | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/pym/portage/util/_dyn_libs/PreservedLibsRegistry.py b/pym/portage/util/_dyn_libs/PreservedLibsRegistry.py
index f3cbb33..3fb8120 100644
--- a/pym/portage/util/_dyn_libs/PreservedLibsRegistry.py
+++ b/pym/portage/util/_dyn_libs/PreservedLibsRegistry.py
@@ -36,11 +36,16 @@ class PreservedLibsRegistry(object):
def lock(self):
"""Grab an exclusive lock on the preserved libs registry."""
+ if self._lock is not None:
+ raise AssertionError("already locked")
self._lock = lockfile(self._filename)
def unlock(self):
"""Release our exclusive lock on the preserved libs registry."""
+ if self._lock is None:
+ raise AssertionError("not locked")
unlockfile(self._lock)
+ self._lock = None
def load(self):
""" Reload the registry data from file """
@@ -65,7 +70,13 @@ class PreservedLibsRegistry(object):
self.pruneNonExisting()
def store(self):
- """ Store the registry data to file """
+ """
+ Store the registry data to the file. The existing inode will be
+ replaced atomically, so if that inode is currently being used
+ for a lock then that lock will be rendered useless. Therefore,
+ it is important not to call this method until the current lock
+ is ready to be immediately released.
+ """
if os.environ.get("SANDBOX_ON") == "1" or \
self._data == self._data_orig:
return
next reply other threads:[~2011-05-07 17:26 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-07 17:25 Zac Medico [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-05-08 5:02 [gentoo-commits] proj/portage:master commit in: pym/portage/util/_dyn_libs/ Zac Medico
2011-05-08 7:10 Zac Medico
2011-05-08 21:31 Zac Medico
2011-06-30 10:01 Zac Medico
2011-06-30 10:17 Zac Medico
2011-07-01 1:37 Zac Medico
2011-07-01 4:02 Zac Medico
2011-07-01 4:02 Zac Medico
2011-07-20 4:51 Zac Medico
2011-07-20 8:05 Zac Medico
2011-07-22 8:03 Zac Medico
2011-07-22 20:38 Zac Medico
2011-07-23 6:23 Zac Medico
2011-07-24 2:15 Zac Medico
2011-07-24 2:58 Zac Medico
2011-07-24 2:58 Zac Medico
2012-02-01 2:04 Zac Medico
2012-02-18 2:06 Zac Medico
2012-02-18 3:11 Zac Medico
2012-03-05 7:32 Zac Medico
2012-03-21 21:24 Zac Medico
2012-03-22 15:24 Zac Medico
2013-02-22 18:52 Arfrever Frehtes Taifersar Arahesis
2013-03-18 23:35 Zac Medico
2013-03-18 23:43 Zac Medico
2015-04-24 17:53 Zac Medico
2015-06-02 3:48 Zac Medico
2016-06-06 16:03 Zac Medico
2016-12-27 21:43 Zac Medico
2018-01-02 23:04 Zac Medico
2018-05-25 16:12 Zac Medico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48e1b835df5fefe49e2227e37c007d87fade1c55.zmedico@gentoo \
--to=zmedico@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox