def resume_writing(self): # a useful skill for job applicants if _debuglocks: debug.dumpCaller() debug.fmsg('resuming writing', self, id(self)) self.rwLock.write_resume() if _debuglocks: debug.fmsg('resumed writing', self, id(self))
def end_writing(self): parent = self.getParent() # See comment above if parent: parent.end_reading() if _debuglocks: debug.dumpCaller() debug.fmsg('end writing', self, id(self)) self.rwLock.write_release()
def end_reading(self): parent = self.getParent() if parent: parent.end_reading() self.rwLock.read_release() if _debuglocks: debug.dumpCaller() debug.fmsg('ended reading', self, id(self), self.rwLock.nReaders())
def reserve(self): if _debuglocks: debug.dumpCaller() debug.fmsg('reserving', self) self.reservation_lock.acquire() if _debuglocks: debug.fmsg('reserved', self) self.have_reservation = 1 switchboard.notify("made reservation", self)
def begin_reading(self): if _debuglocks: debug.dumpCaller() debug.fmsg('acquiring read lock', self, id(self)) self.rwLock.read_acquire() parent = self.getParent() if parent: parent.begin_reading() if _debuglocks: debug.fmsg('acquired read lock', self, id(self), self.rwLock.nReaders())
def begin_writing(self): if _debuglocks: debug.dumpCaller() debug.fmsg('acquiring write lock', self, id(self)) self.rwLock.write_acquire() # While changing an object, make sure that its parents don't # change as well, because that could effectively change the # object... Since we're not actually changing the parent, we # just acquire the read lock. parent = self.getParent() if parent: parent.begin_reading() if _debuglocks: debug.fmsg('acquired write lock', self, id(self))
def pause_writing(self): if _debuglocks: debug.dumpCaller() debug.fmsg('pause writing', self, id(self)) self.rwLock.write_pause()