libb.syncd
- syncd(lock)[source]
Decorator to synchronize functions with a shared lock.
- Parameters:
lock – Threading lock to acquire during function execution.
- Returns:
Decorator function.
Example:
>>> import threading >>> lock = threading.Lock() >>> @syncd(lock) ... def safe_increment(counter): ... return counter + 1 >>> safe_increment(0) 1