[squeak-dev] Snapshot and Startup

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Snapshot and Startup

Javier Reyes
Hello All,

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

Best,
             Javier Reyes


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Snapshot and Startup

Eliot Miranda-2


On Wed, Jul 16, 2008 at 8:00 AM, Javier Reyes <[hidden email]> 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






Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Snapshot and Startup

Javier Reyes
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 <[hidden email]> wrote:


On Wed, Jul 16, 2008 at 8:00 AM, Javier Reyes <[hidden email]> 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










Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Snapshot and Startup

Eliot Miranda-2


On Wed, Jul 16, 2008 at 10:46 AM, Javier Reyes <[hidden email]> 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 <[hidden email]> wrote:


On Wed, Jul 16, 2008 at 8:00 AM, Javier Reyes <[hidden email]> 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














Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Snapshot and Startup

Javier Reyes
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 <[hidden email]> wrote:


On Wed, Jul 16, 2008 at 10:46 AM, Javier Reyes <[hidden email]> 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 <[hidden email]> wrote:


On Wed, Jul 16, 2008 at 8:00 AM, Javier Reyes <[hidden email]> 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


















Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Snapshot and Startup

Igor Stasenko
2008/7/16 Javier Reyes <[hidden email]>:
> 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.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Snapshot and Startup

Javier Reyes
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 <[hidden email]> wrote:
2008/7/16 Javier Reyes <[hidden email]>:
> 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.