snapshot:andQuit:

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

snapshot:andQuit:

Tony Garnock-Jones-2
Hi all,

I see ObjectMemory>>#snapshot:, but I don't see
ObjectMemory>>#snapshot:andQuit:. Am I missing something? Is there an
idiomatic way to check to see whether we're resuming just after save or
just after load?

Currently, #snapshot: returns ObjectMemory. Could it return a boolean,
or similar, indicating whether we're in the parent just after the save,
or the saved image just after the load?

Tony
--
 [][][] Tony Garnock-Jones     | Mob: +44 (0)7905 974 211
   [][] LShift Ltd             | Tel: +44 (0)20 7729 7060
 []  [] http://www.lshift.net/ | Email: [hidden email]


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: snapshot:andQuit:

Paolo Bonzini
> I see ObjectMemory>>#snapshot:, but I don't see
> ObjectMemory>>#snapshot:andQuit:. Am I missing something? Is there an
> idiomatic way to check to see whether we're resuming just after save or
> just after load?

No, I never thought of it.

> Currently, #snapshot: returns ObjectMemory. Could it return a boolean,
> or similar, indicating whether we're in the parent just after the save,
> or the saved image just after the load?

Yes, it could.  Note that if the caller of #snapshot: is a CallinProcess
it does not survive image load; all CallinProcesses are not restarted in
the saved image (see fixup_object in save.c).

It should be enough to change

       PROTECT_CURRENT_PROCESS_WITH (&localJmpBuf)
         success = _gst_save_to_file (fileName);

to

       /* fork(2)-style.  Return true for the saved file...  */
       SET_STACK_TOP (_gst_true_oop);
       PROTECT_CURRENT_PROCESS_WITH (&localJmpBuf)
         success = _gst_save_to_file (fileName);

       /* ... and false for the saving process.  */
       SET_STACK_TOP (_gst_false_oop);

in libgst/prims.def.

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk