We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8f30db7 commit a33c28cCopy full SHA for a33c28c
1 file changed
codeguru_profiler_agent/utils/synchronization.py
@@ -0,0 +1,15 @@
1
+import functools
2
+import threading
3
+
4
5
+def synchronized(wrapped):
6
+ """The missing @synchronized decorator
7
8
+ https://git.io/vydTA"""
9
+ _lock = threading.RLock()
10
11
+ @functools.wraps(wrapped)
12
+ def _wrapper(*args, **kwargs):
13
+ with _lock:
14
+ return wrapped(*args, **kwargs)
15
+ return _wrapper
0 commit comments