I guess the following standard method will help : class MyLocker(object): def __init__(self, lock): self.lock = lock self.lock.acquire()
def __del__(self): self.lock.release() Then whenever you need to acquire a lock: templock = MyLocker(self.__mutex) del templock # will release the lock (provided you didn't create an extra link to this object) -- http://mail.python.org/mailman/listinfo/python-list