File tree Expand file tree Collapse file tree
dm_control/mujoco/wrapper Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525import os
2626import platform
2727import sys
28- import threading
2928from dm_control import _render
3029import numpy as np
3130import six
@@ -164,20 +163,16 @@ class CachedProperty(property):
164163
165164 def __init__ (self , func , doc = None ):
166165 super (CachedProperty , self ).__init__ (fget = func , doc = doc )
167- self .lock = threading . RLock ()
166+ self ._name = func . __name__
168167
169168 def __get__ (self , obj , cls ):
170169 if obj is None :
171170 return self
172- name = self .fget .__name__
173171 obj_dict = obj .__dict__
174- with self .lock :
175- try :
176- # Return cached result if it was computed before the lock was acquired
177- return obj_dict [name ]
178- except KeyError :
179- # Otherwise call the function, cache the result, and return it
180- return obj_dict .setdefault (name , self .fget (obj ))
172+ try :
173+ return obj_dict [self ._name ]
174+ except KeyError :
175+ return obj_dict .setdefault (self ._name , self .fget (obj ))
181176
182177
183178def _as_array (src , shape ):
You can’t perform that action at this time.
0 commit comments