diff --git a/src/06-thread-safety/safe_bank_fine_grained.py b/src/06-thread-safety/safe_bank_fine_grained.py index c786964..876641b 100644 --- a/src/06-thread-safety/safe_bank_fine_grained.py +++ b/src/06-thread-safety/safe_bank_fine_grained.py @@ -91,7 +91,7 @@ def validate_bank(accounts: List[Account], total: int, quiet=False): # with transfer_lock: # current = sum(a.balance for a in accounts) - [a.lock.acquire() for a in accounts] + [a.lock.acquire() for a in sorted(accounts, key=lambda x: id(x))] current = sum(a.balance for a in accounts) [a.lock.release() for a in accounts]