def synchronized(func):
"""Decorator for storage-access methods, which synchronizes on a threading
lock. The parent object must have 'is_closed' and '_sync_lock' attributes.
"""
@wraps(func)
def synchronized_wrapper(self, *args, **kwargs):
with self._sync_lock:
return func(self, *args, **kwargs)
return synchronized_wrapper
代码在 whoosh/src/util.py 中,我无法理解 synchronized_wrapper 的效果和 synchronized_wrapper(self, *args, **kwargs) 中的参数从哪里来。谁能给我一些指示?