MCPcopy Create free account
hub / github.com/apache/qpid-proton / AtomicCount

Class AtomicCount

python/proton/_utils.py:565–577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

563
564
565class AtomicCount:
566 def __init__(self, start: int = 0, step: int = 1) -> None:
567 """Thread-safe atomic counter. Start at start, increment by step."""
568 self.count, self.step = start, step
569 self.lock = threading.Lock()
570
571 def next(self) -> int:
572 """Get the next value"""
573 self.lock.acquire()
574 self.count += self.step
575 result = self.count
576 self.lock.release()
577 return result
578
579
580class SyncRequestResponse(IncomingMessageHandler):

Callers 1

SyncRequestResponseClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected