def __getLock(self): self.notify.info('Acquiring Panda lock for the first time.') from pandac.PandaModules import Thread, Mutex self.__dict__.setdefault('lock', Mutex('Messenger')) self.lock.acquire() self.acquire = self.lock.acquire self.notify.info('Waiting for cheesy lock to be released.') while self.locked: Thread.forceYield() self.notify.info('Got cheesy lock.')
def __getLock(self): # Now that we've started Panda, it's safe to import the Mutex # class, which becomes our actual lock. # From now on, this lock will be used. self.notify.info("Acquiring Panda lock for the first time.") from pandac.PandaModules import Thread, Mutex self.__dict__.setdefault('lock', Mutex('Messenger')) self.lock.acquire() self.acquire = self.lock.acquire # Wait for the cheesy lock to be released before we return. self.notify.info("Waiting for cheesy lock to be released.") while self.locked: Thread.forceYield() self.notify.info("Got cheesy lock.")