[squeak-dev] Files | #startUp and #shutDown in FileDirectory

Eliot Miranda eliot.miranda at gmail.com
Thu May 28 22:25:57 UTC 2020


Hi Marcel,

On Thu, May 28, 2020 at 6:42 AM Marcel Taeumel <marcel.taeumel at hpi.de>
wrote:

> Hi Dave!
>
> Thanks. :-)
>
> Considering a bigger but similar, maybe FFI-based, mechanism, do you think
> it makes sense to clean up such things on a fresh startup only instead of
> every snapshot? Think of flushing the entire GPU-state you are currently
> managing just to retain some other in-image object. Seems overkill.
>

It's not just overkill, it is wrong.  This is a very important issue.
Here's an example:

shutDown: quitting

quitting ifTrue: [
ScorePlayer allSubInstancesDo: [:ea | [ea stopMIDIPlaying] on: Error do: []
] ].

This in fact should be done on the startUp: side.

If there is an alternative implementation it would be something like this:

ScorePlayer class>>shutDown

Smalltalk for: self addVeryEarlyStartupAction: [ScorePlayer
allSubInstancesDo: [:ea | [ea stopMIDIPlaying] on: Error do: [] ] ]

where the early startup actions would be executed before the rest of the
startup actions.

But better is, I think, to start-up by

- first suspending any and all runnable processes except the current
process, the finalization process, and maybe the low space process, to stop
any actions left from the snapshot occurring until after start-up is
complete
- run the startUp: actions, having moved things like ScorePlayer
class>>shutDown's body to ScorePlayer class>>startUp:
- carefully consider the ordering of start-up actions (having a pragma
based scheme <dependsOn: #ClassName> would allow automatic sorting of the
list in a rational way)
- resume any processes suspended before start-up




> What's the underlying best practice? :-)
>
> Best,
> Marcel
>
> Am 28.05.2020 15:26:09 schrieb David T. Lewis <lewis at mail.msen.com>:
> On Wed, May 27, 2020 at 08:58:48AM +0200, Marcel Taeumel wrote:
> > Hi, there. :-)
> >
> > Why do we reset file-related stuff (e.g. source file handles, default
> directory class)?? on every snapshot? Shouldn't there be a check for
> "resuming" (or "quitting") in FileDirectory class >> #startUp(:) (and
> #shutDown(:))?
> >
> > ...or am I missing something? Tim (tpr)! You started it in 2003. Please,
> explain.??:-D
> >
> > Maybe ... we don't ever want to store dangling source-file handles in
> the image?
> >
>
> Yes I think that is the reason. The image snapshot should contain little or
> no platform-specific stuff, and there is no point in allowing it to contain
> obsolete file handles that would need to be detected by primitive fallback
> code when the snapshot is next loaded.
>
> After all, the image that you snapshot today may next be opened by someone
> with a Risc OS computer :-)
>
> Dave
>
>
>

-- 
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200528/f194cb74/attachment.html>


More information about the Squeak-dev mailing list