* jacob navia:

>
> One of the reasons (besides the nullity of my code generator of course) 
> was that gcc cached the values of the global "table" in registers, 
> reading it just once. Since there are many accesses in the most busy 
> function in the program, gcc speeds up considerably.
>
> Clever, but there is a problem with that: the generated program becomes 
> completely thread unfriendly. It will read the value once, and then, 
> even if another thread modifies the value, it will use the old value.

Have you tried using relaxed atomics?

Reply via email to