[Glass] Class var and class inst var caches in libraries

monty via Glass glass at lists.gemtalksystems.com
Sun Oct 9 17:40:40 PDT 2016


Thanks Dale and Paul. I've given up on making my libs #fork-safe on GS because after looking at the source for some of the GS(DevKit) methods I would use, I don't think they can guarantee it.

Instead I'm just focusing on preventing write conflicts. My solution now is forcing explicit initialization of normally lazy-initialized class/class inst vars in a Metacello postLoad on GS. Since the values are mostly immutable, they can be safely persisted, and since the mutable values are all instances of a custom dictionary-like cache class that uses a TransientRecursionLock to guard access to an internal collection wrapped in a TransientValue on GS, these instances can be safely persisted too. In my tests this eliminated all write conflicts, so XMLParser, XMLParserHTML, XMLParserStAX, XPath, and XMLWriter should all be conflict-free during normal use.
 


More information about the Glass mailing list