MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / LockingGrid

Class LockingGrid

example_code/item_072.py:79–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77
78
79class LockingGrid(Grid):
80 def __init__(self, height, width):
81 super().__init__(height, width)
82 self.lock = Lock()
83
84 def __str__(self):
85 with self.lock:
86 return super().__str__()
87
88 def get(self, y, x):
89 with self.lock:
90 return super().get(y, x)
91
92 def set(self, y, x, state):
93 with self.lock:
94 return super().set(y, x, state)
95
96
97print("Example 2")

Callers 2

simulate_threadedFunction · 0.70
item_072.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected