Saving the image in the background

Damien Cassou damien.cassou at laposte.net
Sun Jul 30 13:02:48 UTC 2006


Peter Crowther wrote:
>> From: Damien Cassou
>> I would like to know if the following code is safe:
>>
>> [SmalltalkImage current snapshot: true andQuit: false]
>>      forkAt: Processor userBackgroundPriority
>>
>> Is there any problem if the main process modifies something 
>> in the same time ?
> 
> In general it is not safe.  Code before the snapshot puts a number of
> objects into a state suitable for recovery after the image restarts, and
> code after the snapshot restores them.  You also are forking at
> userBackgroundPriority, which means that the system's tidy-up before a
> snapshot and recovery after a snapshot could be pre-empted by your own
> processes, so you might get errors in the main process from a
> freshly-started image that has only partly recovered when restarted.
> 
> Your specific case may not trigger any of the problems - follow the code
> through the various hooks to see what is affected.

Is it better if I do not fork at all ?



More information about the Squeak-dev mailing list