Skip to content

Commit dddaba4

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents a3843d3 + a069745 commit dddaba4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/06-thread-safety/safe_bank_fine_grained.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def validate_bank(accounts: List[Account], total: int, quiet=False):
9191
# with transfer_lock:
9292
# current = sum(a.balance for a in accounts)
9393

94-
[a.lock.acquire() for a in accounts]
94+
[a.lock.acquire() for a in sorted(accounts, key=lambda x: id(x))]
9595
current = sum(a.balance for a in accounts)
9696
[a.lock.release() for a in accounts]
9797

0 commit comments

Comments
 (0)