diff options
Diffstat (limited to '')
-rw-r--r-- | portato/db/dict.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/portato/db/dict.py b/portato/db/dict.py index 435cdd9..5c5ca49 100644 --- a/portato/db/dict.py +++ b/portato/db/dict.py @@ -14,7 +14,7 @@ from __future__ import absolute_import, with_statement import re from collections import defaultdict -from functools import wraps +from threading import RLock from ..backend import system from .database import Database, PkgData @@ -22,21 +22,15 @@ from .database import Database, PkgData class DictDatabase (Database): """An internal database which holds a simple dictionary cat -> [package_list].""" + lock = Database.lock + def __init__ (self): """Constructor.""" + Database.__init__(self) + self.__initialize() - self._lock = RLock() self.populate() - def lock (f): - @wraps(f) - def wrapper (self, *args, **kwargs): - with self._lock: - r = f(self, *args, **kwargs) - return r - - return wrapper - def __initialize (self): self._db = defaultdict(list) self.inst_cats = set([self.ALL]) |