Saving the image in the background

Gerardo Richarte gera at corest.com
Sun Jul 30 22:38:03 UTC 2006


Damien dijo:
> 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 ?
>
>   
    The problems have already explained, and I've been following this
thread with great interest, because a "similar" problem we have is to
find a way to save the image doing everything from Squeak (suppose you
want, for example, to "save" the image over the net, using FTP,
implementing the FTP protocol in Squeak: the image will be changing
while you do the networking stuff)

    The solution we came up to, and until somebody finds a better way
(please do!), is to make a copy of the image in a String or ByteArray
(from a primitive). This will effectively duplicate the size of the
image, but so far, is the only solution we found.

    This trick may apply to your case, depending on what you really want
to put in background, but as Klaus said, if you want to put the garbage
collection in background, you cannot do it by forking a Squeak process,
as this is a natively atomic operation, and the same goes for storing
the bits in a file. This two can only be forked natively.

    Any better ideas? please?! :-)

    gera



More information about the Squeak-dev mailing list