We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent af2b2e4 commit 39d019aCopy full SHA for 39d019a
java2python/mod/include/sync.py
@@ -1,10 +1,12 @@
1
+from functools import wraps
2
from threading import RLock
3
4
def lock_for_object(obj, locks={}):
5
return locks.setdefault(id(obj), RLock())
6
7
def synchronized(call):
8
assert call.__code__.co_varnames[0] in {'self', 'cls'}
9
+ @wraps(call)
10
def inner(*args, **kwds):
11
with lock_for_object(args[0]):
12
return call(*args, **kwds)
0 commit comments