def release(self):
        """
        Releases the lock previously locked by a call to acquire().
        Returns None.
        """

        thrCurrent = currentThread()

        self._lock()
        try:

            if self.__log: self._log("releasing exclusive")
            if self.__debug:
                assert self._invariant(), "SharedLock invariant failed: %s in %s" % \
                                          (self._debug_dump(), trace_string())

            if thrCurrent is not self.thrOwner:
                raise Exception("Current thread has not acquired the lock")

            # the thread releases its exclusive lock

            self.intOwnerDepth -= 1
            if self.intOwnerDepth > 0:
                if self.__debug:
                    assert self._invariant(), "SharedLock invariant failed: %s in %s" % \
                                              (self._debug_dump(), trace_string())
                if self.__log: self._log("released exclusive")
                return

            self.thrOwner = None

            # a decision is made which pending thread(s) to awake (if any)

            self._release_threads()
            
            if self.__debug:
                assert self._invariant(), "SharedLock invariant failed: %s in %s" % \
                                          (self._debug_dump(), trace_string())
            if self.__log: self._log("released exclusive")

        finally:
            self._unlock()

        Releases the lock previously locked by a call to acquire().
        Returns None.
        
recipes/Python/465156_Shared_lock_akreaderwriter_lock_timeouts_FIFO/recipe-465156.py