To properly handle exceptions, the code in the previous posting should be modified to include a try...finally block: def ubthreadfunction(f): def g(self, *args, **kwargs): try: self.lock.acquire() ans = f(self, *args, **kwargs) finally: self.lock.release() return ans return g - Connelly