¡@

Home 

python Programming Glossary: lockedmethod

How to make built-in containers (sets, dicts, lists) thread safe?

http://stackoverflow.com/questions/13610654/how-to-make-built-in-containers-sets-dicts-lists-thread-safe

name in 'add' 'remove' # note makes a new callable object lockedmethod on every call # best to add a layer of memoization lock self._lock.. # best to add a layer of memoization lock self._lock def lockedmethod args kwargs with lock return super AttrLockedSet self .__getattribute__.. self .__getattribute__ name args kwargs return lockedmethod else return super AttrLockedSet self .__getattribute__ name..