Am Sat, 25 Jan 2014 21:41:20 +0000 schrieb "Kagamin" <s...@here.lot>:
> On Saturday, 25 January 2014 at 10:00:58 UTC, Johannes Pfau wrote: > > (For example it isn't valid in D to access a shared variable > > with > > normal operations anyway, AFAIK. You need to use the atomicOp > > things > > and these will the worry about the hardware part, using the > > correct > > instructions and so on) > > Is it invalid to access shared data on stack too? How about > closures? > I'm not sure about the details - shared hasn't been completely implemented or even specified yet. AFAIK the most recent idea was that shared does basically nothing but prevents direct access to variables. Synchronized statements then remove the shared qualifier and you can access the variables as usual. Atomic OPs also work with shared variables. Using locks manually then probably requires casting away shared. However, this part of the language is really unfinished. I hoped we could at least use shared as a replacement for volatile, but as you said in your other reply we probably can't.