[Piglit] [PATCH 3/3] framework/threads.py: Remove file

Dylan Baker baker.dylan.c at gmail.com
Tue Apr 1 10:12:56 PDT 2014


This module contained only the synchronized_self decorator. Since that
decorator has been replaced completely by the more idiomatic with lock
syntax this is no longer needed.

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 framework/threads.py | 43 -------------------------------------------
 1 file changed, 43 deletions(-)
 delete mode 100644 framework/threads.py

diff --git a/framework/threads.py b/framework/threads.py
deleted file mode 100644
index ec7dfcc..0000000
--- 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()
-- 
1.9.1



More information about the Piglit mailing list