If one program blocks shutdown, then all programs block shutdown, revisited

No take-backs. The post If one program blocks shutdown, then all programs block shutdown, revisited appeared first on The Old New Thing.

Apr 1, 2025 - 03:30
 0
If one program blocks shutdown, then all programs block shutdown, revisited

Some time ago, I noted that if one program blocks shutdown, then all programs block shutdown. Each program is asked in turn if they have any final words, and only after each program says that it’s finished do we ask the next program.

But what if we asked all the programs for their final words? After all, it’s frustrating to go through two shutdown confirmations from two programs, only to find that the question from the third program is one that you realize “Oh, right, I should send that unfinished email. I need to cancel shutdown.” If you could see all the questions at once, then you would see the third question right away and cancel shutdown without having to deal with the first two programs.

The problem with this design is that the current shutdown mechanism doesn’t have a way for the system to tell programs, “I know I asked you to say your final good-byes, and you’re in the middle of a dialog with the user, but I need you to cancel out of it right now because we’re not shutting down after all.”

That’s not to say that such a mechanism couldn’t be invented, but you’d have to deal with the adoption curve, because the feature doesn’t work until everybody supports it, and in practice, there will always be programs that don’t support it, either because it’s too hard to implement, or because the programs are no longer being maintained by their vendors.

Windows has instead been encouraging programs to dispense with the farewells entirely.

Programs written to the Universal Windows Platform, for example, never even get told that the system is shutting down. They are expected to autosave any relevant state whenever they receive a notification from the system that they are about to be suspended, and once suspended, the system is permitted to terminate the program without any further warning. And programs that adhere to the classic application model are encouraged to employ their own autosave/autorecover logic so that the user can shut down with a minimum of fuss.

I mean, when you power off your phone, you don’t get a barrage of apps asking you if you want to save. They just go away quietly, and when you launch them next time, they try to pick up where they left off.

In other words, instead of trying to make the shutdown problem easier to deal with, Windows is trying to make the shutdown problem go away.

The post If one program blocks shutdown, then all programs block shutdown, revisited appeared first on The Old New Thing.