def __init__(self, name, classname, obj, parent, secretFlag=0): self._name = name self._obj = obj self.classname = classname # not necessarily the Python class name, # but just a name to be listed in GUI. self.parent = parent self.switchboardCallbacks = [] # self.timestamp = timestamp.TimeStamp() ## Locking variables self.have_reservation = 0 ## Locking methods. self.reservation_lock = lock.Lock( ) ## holds the Who writing privileges # Create an rwlock. Subclasses may share this lock with their # contained objects. self.rwLock = lock.RWLock() ## secret flag for hiding it from the user ## TODO 3.1: For some situation where this who object need to ## be secret for some kind of display and not for another the ## boolean type would not be enough. We will have to think of ## another structure to handle different kind of display and ## different kind of secrecy for those displays. self.secretFlag = secretFlag
def __init__(self, skeletoncontext): self.skeletoncontext = skeletoncontext self.rwLock = lock.RWLock() self.sbcallbacks = [ switchboard.requestCallback(('whodoundo push', 'Skeleton'), self.whoChanged0) ]
def __init__(self, skeletoncontext): self.timestamp = timestamp.TimeStamp() self.skeletoncontext = skeletoncontext self.rwLock = lock.RWLock() self.sbcallbacks = [ # switchboard.requestCallback(('who changed', 'Skeleton'), # self.newSkeleton), switchboard.requestCallback(('whodoundo push', 'Skeleton'), self.whoChanged0) ]
def __init__(self, name, classname, obj, parent, secretFlag=0): self._name = name self._obj = obj self.classname = classname # not necessarily the Python class name, # but just a name to be listed in GUI. self.parent = parent self.switchboardCallbacks = [] self.timestamp = timestamp.TimeStamp() ## Locking variables self.have_reservation = 0 ## Locking methods. self.reservation_lock = lock.Lock( ) ## holds the Who writing privileges # Create an rwlock. Subclasses may share this lock with their # contained objects. self.rwLock = lock.RWLock() ## secret flag for hiding it from the user self.secretFlag = secretFlag
errmenu.addItem(OOFMenuItem('Infinite_Loop', callback=loop, threadable=oofmenu.THREADABLE, help="I hope you have lots of time.")) def spinCycle(menuitem, nCycles): cdebug.spinCycle(nCycles) debugmenu.addItem(OOFMenuItem('SpinCycle', callback=spinCycle, params=[IntParameter('nCycles', 100000)])) import os from ooflib.SWIG.common import lock import time rw = lock.RWLock() lockmenu = debugmenu.addItem(OOFMenuItem("LockTest", no_doc=True, secret=not debug.debug())) def _py_read(menuitem, seconds): global rw rw.read_acquire() print "Got read permission for %d seconds." % seconds time.sleep(seconds) print "Releasing read." rw.read_release() def _py_write(menuitem, seconds): global rw rw.write_acquire()