Something needs to happen with shared, and soon.

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Nov 13 14:30:16 PST 2012


On 11/13/12 2:07 PM, Peter Alexander wrote:
> On Tuesday, 13 November 2012 at 21:56:21 UTC, Andrei Alexandrescu wrote:
>> On 11/13/12 1:28 PM, Walter Bright wrote:
>>> On 11/13/2012 1:11 AM, luka8088 wrote:
>>>> This clarifies a lot, but still a lot of people get confused with:
>>>> http://dlang.org/faq.html#shared_memory_barriers
>>>> is it a faq error ?
>>>
>>> Andrei is a proponent of having shared to memory barriers, I disagree
>>> with him. We haven't convinced each other yet, so this is a bit up in
>>> the air.
>>
>> Wait, then what would shared do? This is new to me as I've always
>> assumed you and I have the same view on this.
>>
>> Andrei
>
> I'm speaking out of turn, but...
>
> I'll flip that around: what would shared do if there were memory barriers?
>
> Walter has said previously in this thread that shared is to be used to
> mark shared data, and disallow any potentially non-thread-safe
> operations. To use shared data, you need to manually lock it and then
> cast away the shared temporarily. This can be made more pleasant with
> library utilities.

Oh ok, thanks. That does make sense. There's been quite a bit of 
discussion between Bartosz, Walter, and myself about allowing 
transparent loads and stores as opposed to defining intrinsics x.load 
and x.store(y). In C++11 both transparent and implicit are allowed, and 
an emergent idiom is "already use the explicit versions because they 
clarify flow and cost".


Andrei


More information about the Digitalmars-d mailing list