Atomically increment the counter by num and return the new value
(self, num=1)
| 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""" |