Little error for explanation of race condition banking example

MilkClouds 2022-06-30 18:20:14 +09:00
parent 89e23a8daf
commit cfaed621ae

@ -186,8 +186,8 @@ Hence, the following may occur:
2. Before updating *Account B*, *Task AB* sends two messages and during that time, the event loop continues *Task BA*
3. *Task BA* executes `bank.write_account(source)` and updates *Account B* with *-$100*
4. Before updating *Account A*, *Task BA* sends two messages and during that time, the event loop continues *Task AB*
5. *Task AB* executes `bank.write_account(target)` and updates *Account B* with *+$100*
6. When *Task BA* is resumed again, it executes `bank.write_account(target)` and updates *Account A* with *+$10*
5. *Task AB* executes `bank.write_account(target)` and updates *Account B* with *+$10*
6. When *Task BA* is resumed again, it executes `bank.write_account(target)` and updates *Account A* with *+$100*
In the end, *Account A* is at *+$100* and *Account B* is at *+$10*.
Of course, this won't happen very often.