|
|
|
|
|
by maelkum
3224 days ago
|
|
Maybe... but not everything can be cancelled. What if you are too late and, say, asynchronous write to a disk was already commited and the data is out of your program and on the drive? And how do you cancel a sent email? At some point there is no sense in sending a "cancel" message, or there is no way of cancelling an action. How would you proceed in such a situation? |
|
Eg. imagine that a document is auto-saved in the background, but the network is busy. Then the user changes the document. Now the app wants to auto-save the new version, but the previous version hasn't been saved yet. Saving the previous version no longer makes any sense and would just waste time, so you want to cancel the previous save operation, and save the new version instead. (it doesn't matter if cancelling the previous save is successful or not -- all that matters is that you don't want to wait for the previous action)
Or imagine that an app opens and tries to show the last document that the user displayed. The document is big, so the app shows a loading indicator. But the user doesn't want to actually view the document, he wants to view a different document, so he closes the document and opens a different one. Now the app needs to cancel loading the first document, because otherwise it would take much longer to load the second document that the user actually wants to see.