diff options
author | Dylan Baker <dylanx.c.baker@intel.com> | 2014-12-12 09:42:22 -0800 |
---|---|---|
committer | Dylan Baker <dylanx.c.baker@intel.com> | 2014-12-24 10:35:13 -0800 |
commit | 42ffd36eb3f608db8224b2ddb6e35e230d27b19e (patch) | |
tree | dd1abfc11275ee975fccfbc259a857ebd1702a36 /framework | |
parent | 11ccec579de6121dc7f3260dae2076920f4dea44 (diff) |
remove framework/threads.py
This file hasn't been used for quite some time, at least since the
atomic backend work landed.
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/threads.py | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/framework/threads.py b/framework/threads.py deleted file mode 100644 index ec7dfcc4f..000000000 --- a/framework/threads.py +++ /dev/null @@ -1,43 +0,0 @@ -# -# Copyright (c) 2010 Intel Corporation -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# - -from weakref import WeakKeyDictionary -from threading import RLock - - -def synchronized_self(function): - ''' - A decorator function for providing multithreaded, synchronized access - amongst one or more functions within a class instance. - ''' - def wrapper(self, *args, **kwargs): - synchronized_self.locks.setdefault(self, RLock()).acquire() - try: - return function(self, *args, **kwargs) - finally: - synchronized_self.locks[self].release() - return wrapper - - -# track the locks for each instance -synchronized_self.locks = WeakKeyDictionary() |