Linked by Thom Holwerda on Sun 9th Sep 2007 18:08 UTC, submitted by koki
BeOS & Derivatives "The primary intention of my previous article was to make it very clear why and when locking is needed in multithreaded applications. In this article, I want to present my experiences in writing a new prototype for a replacement of the document model in WonderBrush and how it is manipulated and rendered asynchronously."
Permalink for comment 269959
To read all comments associated with this story, please click here.
stippi
Member since:
2006-01-19

You are omitting something which I mentioned in my article several times, which is that the code got _cleaner_ instead of more messy. From just the code that I posted, you wouldn't see this, but the important bit is that the rendering related code got separated out of the document model code. The ObjectSnapshot derived classes contain all sorts of code related only to rendering, while the Object derived classes are freed of it. In another words, the majority of the code that is in the snapshot would have to be _somewhere_ anyways. The code for adding the proper locking on top is very little. And it doesn't have to grow with more objects/features. The only duplication of code is in storing the object data in the object and the snapshot, but even that could be refactored. Then you would be left with very little overhead code-wise.

Reply Parent Score: 2