[stringtemplate-interest] thread safety
Terence Parr
parrt at cs.usfca.edu
Fri Nov 13 13:14:28 PST 2009
ah right. i always assume it's volatile but hotspot could assume non
volatile.
T
On Nov 13, 2009, at 1:02 PM, John D. Mitchell wrote:
> On Nov 13, 2009, at 12:08 , Terence Parr wrote:
>> On Nov 13, 2009, at 11:55 AM, John D. Mitchell wrote:
>>>> Oh right. cache invalidation / reload would need to be atomic.
>>>> I'll
>>>> have to lock for that.
>>>
>>> Should be cheap as you're just swapping a pointer to the newly
>>> loaded
>>> & compiled object, right?
>>
>> Should be something like "load in background then swap with single
>> ptr". that should be thread safe, right? ptr assign is atomic.
>
> Remember to mark it as "volatile".
>
> Have fun,
> John
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
More information about the stringtemplate-interest
mailing list