(self)
Acquire the module lock.  If a potential deadlock is detected,
        a _DeadlockError is raised.
        Otherwise, the lock is always acquired and True is returned.
Acquire the module lock.  If a potential deadlock is detected,
        a _DeadlockError is raised.
        Otherwise, the lock is always acquired and True is returned.
Acquire the module lock . If a potential deadlock is detected a _DeadlockError is raised . Otherwise the lock is always acquired and True is returned .
def acquire(self):
        """
        Acquire the module lock.  If a potential deadlock is detected,
        a _DeadlockError is raised.
        Otherwise, the lock is always acquired and True is returned.
        """
        tid = _thread.get_ident()
        _blocking_on[tid] = self
        try:
            while True:
                with self.lock:
                    if self.count == 0 or self.owner == tid:
                        self.owner = tid
                        self.count += 1
                        return True
                    if self.has_deadlock():
                        raise _DeadlockError('deadlock detected by %r' % self)
                    if self.wakeup.acquire(False):
                        self.waiters += 1
                # Wait for a release() call
                self.wakeup.acquire()
                self.wakeup.release()
        finally:
            del _blocking_on[tid]
def acquire ( self ) : tid = _thread . get_ident ( ) _blocking_on [ tid ] = self try : while True : with self . lock : if self . count == 0 or self . owner == tid : self . owner = tid self . count += 1 return True if self . has_deadlock ( ) : raise _DeadlockError ( 'deadlock detected by %r' % self ) if self . wakeup . acquire ( False ) : self . waiters += 1 # Wait for a release() call self . wakeup . acquire ( ) self . wakeup . release ( ) finally : del _blocking_on [ tid ]