[stringtemplate-interest] Thread safety issue in Template .NET

James P. Moring jmoring at gmail.com
Wed Jan 25 05:36:39 PST 2012


The Add method of Template is synchronized. This is used to guard access 
to the shared member impl. A synchronized method only locks the method 
for calls on the same instance thus leaving impl to be accessed via 
multiple threads. The method should employ a lock on impl as follows or 
am I missing something? Thanks

lock(impl)
{

     if( impl.HasFormalArgs )
         ...
     else
         ....

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20120125/1ee71f25/attachment.html 


More information about the stringtemplate-interest mailing list