MCPcopy Create free account
hub / github.com/dabeaz/python-cookbook / decr

Method decr

src/12/how_to_lock_critical_sections/example1.py:18–23  ·  view source on GitHub ↗

Decrement the counter with locking

(self,delta=1)

Source from the content-addressed store, hash-verified

16 self._value += delta
17
18 def decr(self,delta=1):
19 '''
20 Decrement the counter with locking
21 '''
22 with self._value_lock:
23 self._value -= delta
24
25def test(c):
26 for n in range(1000000):

Callers 1

testFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected