Javier Reyes | 16 Jul 17:00

Snapshot and Startup

Hello All,

¿Is there a way to save the current image without invoking all the registered startup methods immediately ?

Best,
             Javier Reyes

Eliot Miranda | 16 Jul 17:27

Re: Snapshot and Startup



On Wed, Jul 16, 2008 at 8:00 AM, Javier Reyes <jreyes <at> gmail.com> wrote:
Hello All,

¿Is there a way to save the current image without invoking all the registered startup methods immediately ?

Write your own surround to the snapshot primitive and you can make the startup do whatever you want.  Have a look at SystemDictionary>>snapshot:andQuit:embedded: and what it does after it calls snapshotPrimitive.


 


Best,
             Javier Reyes





Javier Reyes | 16 Jul 19:46

Re: Snapshot and Startup

Hi Eliot,

I have tried wrapping snapshot:andQuit:embedded: in different ways freezing the system all the time. The minimal intervention I could figure out from your message has been this ( I think I understand now why I never thought about writing something like BrouHaHa ;-)


------------
snapshot:andQuit:embedded:
...
....
...
    Smalltalk myProcessStartUpList: resuming == true.
    resuming == true ifTrue:[
        self setPlatformPreferences.
        self recordStartupStamp].
    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! !

------------

myProcessStartUpList: resuming
    "Send #startUp to each class that needs to run initialization after a snapshot."

    self send: #startUp: toClassesNamedIn: (self lista) with: resuming.
! !

----------

!SystemDictionary methodsFor: 'snapshot and quit' stamp: 'jr 7/16/2008 19:17'!
lista
(StartUpList select: [:a| (a==#MyAppSingletonClass) not]).
! !

----------
Best,

              Javier





On Wed, Jul 16, 2008 at 5:27 PM, Eliot Miranda <eliot.miranda <at> gmail.com> wrote:


On Wed, Jul 16, 2008 at 8:00 AM, Javier Reyes <jreyes <at> gmail.com> wrote:
Hello All,

¿Is there a way to save the current image without invoking all the registered startup methods immediately ?

Write your own surround to the snapshot primitive and you can make the startup do whatever you want.  Have a look at SystemDictionary>>snapshot:andQuit:embedded: and what it does after it calls snapshotPrimitive.


 


Best,
             Javier Reyes









Eliot Miranda | 16 Jul 20:15

Re: Snapshot and Startup



On Wed, Jul 16, 2008 at 10:46 AM, Javier Reyes <jreyes <at> gmail.com> wrote:
Hi Eliot,

I have tried wrapping snapshot:andQuit:embedded: in different ways freezing the system all the time. The minimal intervention I could figure out from your message has been this ( I think I understand now why I never thought about writing something like BrouHaHa ;-)

:)  You never know how easy it is until you try, try and try again.  I didn't just write BrouHaHa. I failed to write it a number of times until I got it right.  One learns from mistakes.  Anyone who says they just get it right first time either has a selective memory or has never done anything non-trivial :)




------------
snapshot:andQuit:embedded:
...
....
...
    Smalltalk myProcessStartUpList: resuming == true.
    resuming == true ifTrue:[
        self setPlatformPreferences.
        self recordStartupStamp].
    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! !

------------

myProcessStartUpList: resuming
    "Send #startUp to each class that needs to run initialization after a snapshot."

    self send: #startUp: toClassesNamedIn: (self lista) with: resuming.
! !

----------

!SystemDictionary methodsFor: 'snapshot and quit' stamp: 'jr 7/16/2008 19:17'!
lista
(StartUpList select: [:a| (a==#MyAppSingletonClass) not]).
! !

----------
Best,

              Javier





On Wed, Jul 16, 2008 at 5:27 PM, Eliot Miranda <eliot.miranda <at> gmail.com> wrote:


On Wed, Jul 16, 2008 at 8:00 AM, Javier Reyes <jreyes <at> gmail.com> wrote:
Hello All,

¿Is there a way to save the current image without invoking all the registered startup methods immediately ?

Write your own surround to the snapshot primitive and you can make the startup do whatever you want.  Have a look at SystemDictionary>>snapshot:andQuit:embedded: and what it does after it calls snapshotPrimitive.


 


Best,
             Javier Reyes













Javier Reyes | 16 Jul 21:14

Re: Snapshot and Startup

Eliot,

Your comment is very encouraging, but that was already understood without posting anything here. Encouraging is welcome , but advice is even better received. In my method mySnapshot:andQuit:embedded: as far as I understand the only difference with the original is that my class is not called for startup. Does anyone have any hint of what could be going wrong ? (And thanks again Eliot)

           Javier



On Wed, Jul 16, 2008 at 8:15 PM, Eliot Miranda <eliot.miranda <at> gmail.com> wrote:


On Wed, Jul 16, 2008 at 10:46 AM, Javier Reyes <jreyes <at> gmail.com> wrote:
Hi Eliot,

I have tried wrapping snapshot:andQuit:embedded: in different ways freezing the system all the time. The minimal intervention I could figure out from your message has been this ( I think I understand now why I never thought about writing something like BrouHaHa ;-)

:)  You never know how easy it is until you try, try and try again.  I didn't just write BrouHaHa. I failed to write it a number of times until I got it right.  One learns from mistakes.  Anyone who says they just get it right first time either has a selective memory or has never done anything non-trivial :)




------------
snapshot:andQuit:embedded:
...
....
...
    Smalltalk myProcessStartUpList: resuming == true.
    resuming == true ifTrue:[
        self setPlatformPreferences.
        self recordStartupStamp].
    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! !

------------

myProcessStartUpList: resuming
    "Send #startUp to each class that needs to run initialization after a snapshot."

    self send: #startUp: toClassesNamedIn: (self lista) with: resuming.
! !

----------

!SystemDictionary methodsFor: 'snapshot and quit' stamp: 'jr 7/16/2008 19:17'!
lista
(StartUpList select: [:a| (a==#MyAppSingletonClass) not]).
! !

----------
Best,

              Javier





On Wed, Jul 16, 2008 at 5:27 PM, Eliot Miranda <eliot.miranda <at> gmail.com> wrote:


On Wed, Jul 16, 2008 at 8:00 AM, Javier Reyes <jreyes <at> gmail.com> wrote:
Hello All,

¿Is there a way to save the current image without invoking all the registered startup methods immediately ?

Write your own surround to the snapshot primitive and you can make the startup do whatever you want.  Have a look at SystemDictionary>>snapshot:andQuit:embedded: and what it does after it calls snapshotPrimitive.


 


Best,
             Javier Reyes

















Igor Stasenko | 16 Jul 21:57

Re: Snapshot and Startup

2008/7/16 Javier Reyes <jreyes <at> gmail.com>:
> Eliot,
>
> Your comment is very encouraging, but that was already understood without
> posting anything here. Encouraging is welcome , but advice is even better
> received. In my method mySnapshot:andQuit:embedded: as far as I understand
> the only difference with the original is that my class is not called for
> startup. Does anyone have any hint of what could be going wrong ? (And
> thanks again Eliot)
>

You should register your class in startup/shutdown lists. Then
corresponding method will be called.

There is not much need in replacing snapshot:andQuit:embedded: method
by own, if you still want to have everything work as before.
Many things depending on correct startup to make UI responding. A
critical one is for Delay, InputSensors and UI process.

--

-- 
Best regards,
Igor Stasenko AKA sig.

Javier Reyes | 17 Jul 00:35

Re: Snapshot and Startup

Igor and Eliot,

Thanks for the information. I had also made a mistake and my lista method wasnt returning its result (oops!) I changed it and it goes fine now. So thank you Eliot too and you were right about trying;-)

Best regards,

                      Javier

On Wed, Jul 16, 2008 at 9:57 PM, Igor Stasenko <siguctua <at> gmail.com> wrote:
2008/7/16 Javier Reyes <jreyes <at> gmail.com>:
> Eliot,
>
> Your comment is very encouraging, but that was already understood without
> posting anything here. Encouraging is welcome , but advice is even better
> received. In my method mySnapshot:andQuit:embedded: as far as I understand
> the only difference with the original is that my class is not called for
> startup. Does anyone have any hint of what could be going wrong ? (And
> thanks again Eliot)
>

You should register your class in startup/shutdown lists. Then
corresponding method will be called.

There is not much need in replacing snapshot:andQuit:embedded: method
by own, if you still want to have everything work as before.
Many things depending on correct startup to make UI responding. A
critical one is for Delay, InputSensors and UI process.




--
Best regards,
Igor Stasenko AKA sig.




Gmane