'From Pharo2.0a of ''18 April 2012'' [Latest update: #20267] on 9 October 2012 at 2:52:18 pm'! Object subclass: #SmalltalkImage instanceVariableNames: 'globals deferredStartupActions specialObjectsArray session ' classVariableNames: 'CheckChangesFileAvailability CheckSourcesFileAvailability EndianCache LastImagePath LastQuitLogPosition LowSpaceProcess LowSpaceSemaphore MemoryHogs ShutDownList SourceFileVersionString SpecialSelectors StartUpList Tools ' poolDictionaries: '' category: 'System-Support'! !SmalltalkImage methodsFor: 'accessing' stamp: 'IgorStasenko 10/9/2012 14:52'! session "Answer the current session object. Currently, there is no assumptions about what protocol(s) a session object should conform to. The only valid use of session object is to compare it using identity comparison, i.e. #== with another session object retrieved before, in order to detect session change. A session changes every time image boots from disk. It doesn't changes on snapshot. " ^ session ifNil: [ session := self newSessionObject ].! ! !SmalltalkImage methodsFor: 'snapshot and quit' stamp: 'IgorStasenko 10/9/2012 14:41'! snapshot: save andQuit: quit "Mark the changes file and close all files as part of #processShutdownList. If save is true, save the current state of this Smalltalk in the image file. If quit is true, then exit to the outer OS shell. The latter part of this method runs when resuming a previously saved image. This resume logic checks for a document file to process when starting up." | snapshotResult resuming startupErrors | self addSnapshotRecord: save andQuit: quit. self shutDownImage: quit. save ifTrue: [ snapshotResult := self snapshotPrimitive. "<-- PC frozen here on image file" resuming := snapshotResult == true ] ifFalse: [ resuming := false ]. (quit and: [ resuming not ]) ifTrue: [ self quitPrimitive ]. "create a new session object if we're booting" resuming ifTrue: [ session := self newSessionObject ]. self startupImage: resuming snapshotWorked: snapshotResult. "We return the resuming state, which may be useful for users to know the state of the image" ^resuming! ! !SmalltalkImage methodsFor: 'private' stamp: 'IgorStasenko 10/9/2012 14:46'! newSessionObject "Just answer unique object, which can never be identical to any previous session object, this is all what we need for detecting session change. A session object don't needs to carry any state, it just needs to be unique (we have plenty of other objects in image which can do this for us). " ^ Object new! ! Object subclass: #SmalltalkImage instanceVariableNames: 'globals deferredStartupActions specialObjectsArray session' classVariableNames: 'CheckChangesFileAvailability CheckSourcesFileAvailability EndianCache LastImagePath LastQuitLogPosition LowSpaceProcess LowSpaceSemaphore MemoryHogs ShutDownList SourceFileVersionString SpecialSelectors StartUpList Tools' poolDictionaries: '' category: 'System-Support'!