[h5py] 25/455: locking stub
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:13 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag 1.3.0
in repository h5py.
commit d41854f8f40769f7561d5fc1ddb4ed9a4382567e
Author: andrewcollette <andrew.collette at gmail.com>
Date: Fri May 23 03:16:54 2008 +0000
locking stub
---
h5py/transactions.py | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/h5py/transactions.py b/h5py/transactions.py
index 9eadbea..fd5a170 100644
--- a/h5py/transactions.py
+++ b/h5py/transactions.py
@@ -113,6 +113,8 @@ class TransactionManager(object):
"""
self.stack = None
self.ptr = None
+ if max_size < 1:
+ raise ValueError("Stack size must be at least 1 (got %d)" % max_size)
self.max_size = max_size
def _check(self):
@@ -225,8 +227,47 @@ class TransactionManager(object):
+class LockManger(object):
+ """
+ Trivial locking class.
+ """
+
+ def __init__(self):
+ self.locks = set()
+
+ def is_locked(self, item):
+ return item in self.locks
+
+ def lock(self, item):
+
+ if item in self.locks:
+ return False
+ self.locks.add(item)
+ return True
+
+ def release(self, item):
+ if not item in self.locks:
+ raise ValueError("%s is not locked" % item)
+ self.locks.remove(item)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/h5py.git
More information about the debian-science-commits
mailing list