Created
September 26, 2023 20:26
-
-
Save Simsso/7cba4e5f24dee8a509052270cf6c73d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def synchronized(func): | |
| """Wraps a function with a threading lock.""" | |
| lock = threading.Lock() | |
| def wrapper(*args, **kwargs): | |
| with lock: | |
| return func(*args, **kwargs) | |
| return wrapper |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment