[dmd-concurrency] draft 7
Sean Kelly
sean at invisibleduck.org
Tue Feb 2 07:08:19 PST 2010
On Feb 1, 2010, at 10:19 PM, Robert Jacques wrote:
> On Tue, 02 Feb 2010 01:04:37 -0500, Sean Kelly <sean at invisibleduck.org> wrote:
>>> A problem that can come up is that the variable is promoted to a register in a loop and is not updated from the memory.
>>> To avoid this one can use volatile. This issue is a priory disconnected with the presence of barriers (well one would hope that a correct compiler disables "upgrading to registers" for variables in a locked section crossing the boundary of it, but a priory it doesn't have to be like that, and especially using just memory barriers, I would not trust current compilers to always do the correct thing without a "volatile".
>>
>> Sadly, volatile is deprecated in D 2.0. You pretty much have to use inline asm and rely on the fact that Walter has said D compilers should never optimize in or across asm code.
>
> Well, to the best of my knowledge volatile has never been implemented in D 1.0, which is one of the reason's it was dropped from D 2.0.
I think it was semi-implemented. The compiler didn't optimize functions containing a volatile statement, if I recall.
More information about the dmd-concurrency
mailing list