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

Method inc

22_websockets_server/python/atomic.py:11–15  ·  view source on GitHub ↗

Atomically increment the counter by num and return the new value

(self, num=1)

Source from the content-addressed store, hash-verified

9 self._lock = threading.Lock()
10
11 def inc(self, num=1):
12 """Atomically increment the counter by num and return the new value"""
13 with self._lock:
14 self._value += num
15 return self._value
16
17 def dec(self, num=1):
18 """Atomically decrement the counter by num and return the new value"""

Callers 1

connectMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected