MCPcopy Create free account
hub / github.com/bedroombuilds/python2rust / __init__

Method __init__

22_websockets_server/python/atomic.py:6–9  ·  view source on GitHub ↗

Initialize a new atomic counter to given initial value

(self, initial=0)

Source from the content-addressed store, hash-verified

4class AtomicCounter:
5 """An atomic, thread-safe counter"""
6 def __init__(self, initial=0):
7 """Initialize a new atomic counter to given initial value"""
8 self._value = initial
9 self._lock = threading.Lock()
10
11 def inc(self, num=1):
12 """Atomically increment the counter by num and return the new value"""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected