[stringtemplate-interest] thread safety

Terence Parr parrt at cs.usfca.edu
Sat Nov 14 14:49:14 PST 2009


On Nov 14, 2009, at 1:35 PM, Sam Harwell wrote:

> I think all operations on StringTemplateGroup should be thread safe.

Hmm...well, i'm trying to avoid locking on each call but i guess they  
aren't called as much as getInstanceOf.  I'll look again.

> Operations on StringTemplate are not guaranteed to be thread safe, but
> two templates returned by two calls to getInstanceOf are mutually  
> thread
> safe.

That is true.  An ST is little more than a hashtable and pointer to  
the readonly compiled ST prototype.

Ter


More information about the stringtemplate-interest mailing list