Hi Ned,
I agree that the OS shouldn't change the state of the system when the power comes back up, if it can manage not to. But Squeak _could_ be more power-aware, especially for PDAs.
I don't doubt this (thus my argument for pulling up the event to image level) but do you *really* want to implement all of the stuff below in the VM?! I mean...
We're in a position in the VM to actually remember sockets and file handles.
Why should we? This information is in Squeak already so why duplicate it?
We can hear that the power's going down from the OS and refuse to power down if we have a network file share open that isn't cached locally.
Why should we? It may be perfectly fine to close and power down in most situations.
We can hear that the power came back up and we need to repaint the window.
That we could do ... although Squeak could too given the information so why bother?!
We can notify the OS that we're actually busy when we are doing something so it doesn't power us down.
How could we?! What defines that "we're actually busy" on the VM level?! A call to ioRelinquishProcessorBlaBla?! Happens all the time all over the places.
We could close sockets and remote file handles on power-down. We're already detecting attempted operations on closed handles and raising exceptions. We could if we wanted, remember that we closed the files because of power-down.
Same issue as above. The information is available at the Squeak level so why bother second-guessing at what's actually happening?!
As you point out, handling such errors is the concern of the application, but we could at least raise a recognizable exception to let the application know what happened: i.e. the difference between "tried to read from a file that was already intentionally closed (software error)" and "tried to read from a file that was closed on power down (not a software error)".
Right. But I think any such mechanism should not be handled by the VM. If a file handle was closed and you ship the image containing it to another platform, then suspend it and resume and try to read from the suspended file handle ... why should the VM assume that this handle must be invalid due to resuming?! Much better just to tell Squeak "hey, we wanna get to sleep" and leave it up to it to handle the situation. Then you can implement even more esoteric solutions than Windows must be using ;-))))
Cheers, - Andreas