| 296 | from threading import Lock |
| 297 | |
| 298 | class LockingGrid(Grid): |
| 299 | def __init__(self, height, width): |
| 300 | super().__init__(height, width) |
| 301 | self.lock = Lock() |
| 302 | |
| 303 | def __str__(self): |
| 304 | with self.lock: |
| 305 | return super().__str__() |
| 306 | |
| 307 | def get(self, y, x): |
| 308 | with self.lock: |
| 309 | return super().get(y, x) |
| 310 | |
| 311 | def set(self, y, x, state): |
| 312 | with self.lock: |
| 313 | return super().set(y, x, state) |
| 314 | |
| 315 | |
| 316 | print("Example 8") |
no outgoing calls
no test coverage detected