We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents a3843d3 + a069745 commit dddaba4Copy full SHA for dddaba4
src/06-thread-safety/safe_bank_fine_grained.py
@@ -91,7 +91,7 @@ def validate_bank(accounts: List[Account], total: int, quiet=False):
91
# with transfer_lock:
92
# current = sum(a.balance for a in accounts)
93
94
- [a.lock.acquire() for a in accounts]
+ [a.lock.acquire() for a in sorted(accounts, key=lambda x: id(x))]
95
current = sum(a.balance for a in accounts)
96
[a.lock.release() for a in accounts]
97
0 commit comments