On Fri, Jul 23, 2010 at 09:49:46AM +0200, Lukas Renggli wrote:
But How I can do that without fork? I track changes in another process and when I do update I save image in this process. How I can initiate image saving from ui process?
I don't understand what you are saying.
The thing is that using #fork to save the image has no effect (other than wrecking the image), because #snapshot:andQuit: is eventually calling a primitive that locks the complete VM anyway.
If you want to fork while saving the image you need to use an OS-level fork, not a Smalltalk-level fork. You can do this with OSProcess for example (check the Seaside mailing-list archive).
"UnixProcess saveImageInBackgroundNicely" Explained in the method comment: UnixProcess class>>saveImageInBackground: savedImageName nice: niceFlag "When Squeak is used as a server it is sometimes desirable to periodically save image snapshots. This method forks a headless Squeak to perform a snapshot without impacting the server Squeak. Very little additional memory is required to do this because Unix copy-on-write memory management allows the two Squeak images to share object memory while the save is performed. The saved image is given a time stamped name, and the image name of the main server Squeak remains unchanged. If niceFlag is true, the background OS process runs at lowered scheduling priority." Dave