¡@

Home 

python Programming Glossary: lockattr

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

add the methods cls None def lockmethodfactory methodname lockattr def lockedmethod self args kwargs with getattr self lockattr.. def lockedmethod self args kwargs with getattr self lockattr m getattr super cls self methodname return m args kwargs lockedmethod.__name__.. lockedmethod.__name__ methodname return lockedmethod lockattr _lockname name for methodname in 'add' 'remove' dict_ methodname..