[dmd-concurrency] draft 7

Robert Jacques sandford at jhu.edu
Mon Feb 1 22:19:11 PST 2010


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.


More information about the dmd-concurrency mailing list