[Newbies] Starting

Bert Freudenberg bert at impara.de
Sun Jun 4 18:50:00 UTC 2006

Am 04.06.2006 um 19:57 schrieb mathieu:

> stéphane ducasse a écrit :
>> This is a great question.
>> SmalltalkImage>>snapshot: save andQuit: quit embedded: embeddedFlag
>> the idea is that this is the same method that shutdown the image and
>> that restart it.
>> In fact when shutdoiwn the PC points on the next instruction to be
>> executed that is
>> to resume and restart the image :)
>> Stef
> Ok so if I have understand what you say evry time I quit, the image
> while restart whith at the following instruction (base on my 3.8  
> image):
> 	quit & (resuming == false) ifTrue: [self quitPrimitive].
> 	"Here"
> ->	Cursor normal show.
> 	Smalltalk setGCParameters.
> 	resuming == true ifTrue: [Smalltalk clearExternalObjects].
> 	Smalltalk processStartUpList: resuming == true.
> 	resuming == true ifTrue:[
> 		self setPlatformPreferences.
> 		self readDocumentFile].
> 	Smalltalk isMorphic ifTrue: [SystemWindow  
> wakeUpTopWindowUponStartup].
> 	"Now it's time to raise an error"
> 	resuming == nil ifTrue: [self error:'Failed to write image file (disk
> full?)'].
> 	^ resuming

Almost. The program counter (PC) is frozen "inside" the  
snapshotPrimitive (right above the code you snipped). When saving the  
image (storing an object memory snapshot), that primitive returns  
false, so the quitPrimitive is not called. When starting an image  
(resuming from an earlier snapshot), it returns true. Some startup  
methods need to be run only when starting up, not every time the  
image is saved. That's why the value of this flag is passed to the  
startUp: methods of the classes in the startUpList.

- Bert -

More information about the Beginners mailing list