MCPcopy Index your code
hub / github.com/aws/aws-cli / acquire

Method acquire

awscli/s3transfer/utils.py:691–711  ·  view source on GitHub ↗
(self, tag, blocking=True)

Source from the content-addressed store, hash-verified

689 return self._count
690
691 def acquire(self, tag, blocking=True):
692 logger.debug("Acquiring %s", tag)
693 self._condition.acquire()
694 try:
695 if self._count == 0:
696 if not blocking:
697 raise NoResourcesAvailable(f"Cannot acquire tag '{tag}'")
698 else:
699 while self._count == 0:
700 self._condition.wait()
701 # self._count is no longer zero.
702 # First, check if this is the first time we're seeing this tag.
703 sequence_number = self._tag_sequences[tag]
704 if sequence_number == 0:
705 # First time seeing the tag, so record we're at 0.
706 self._lowest_sequence[tag] = sequence_number
707 self._tag_sequences[tag] += 1
708 self._count -= 1
709 return sequence_number
710 finally:
711 self._condition.release()
712
713 def release(self, tag, acquire_token):
714 sequence_number = acquire_token

Calls 4

acquireMethod · 0.45
waitMethod · 0.45
releaseMethod · 0.45