Locking access to all data members
- From: "gooli" <egooli@xxxxxxxxx>
- Date: 28 Jan 2007 01:31:48 -0800
I have a class with a lot of attributes whose objects are accessed
from multiple threads. I would like to synchronize the access to all
the attributes, i.e. acquire a lock, return the value, release the
lock (in a finally clause).
Is there a way to do that without turning each attribute into a
property and manually wrapping each property with the locking code?
How about classes bound with SQLAlchemy? Is it possible to do that for
those too?
Example of a class I would like to wrap:
class Job(object):
def __init__(self, itemType):
self.id = self.idSequence
self.itemType = itemType
self.status = "waiting"
self.createDate = None
self.hostName = None
self.progress = 0
self.items = []
.
- Follow-Ups:
- Re: Locking access to all data members
- From: Diez B. Roggisch
- Re: Locking access to all data members
- Prev by Date: Re: set update in 2.5
- Next by Date: Re: Crunchy 0.8 release
- Previous by thread: New Way to Search the Information - Ogleo.com - An Integrated Search
- Next by thread: Re: Locking access to all data members
- Index(es):
Relevant Pages
|