d bare bones

eles eles at eles.com
Fri Sep 6 07:26:57 PDT 2013


On Friday, 6 September 2013 at 14:10:06 UTC, Iain Buclaw wrote:
> On 6 September 2013 14:34, eles <eles at eles.com> wrote:
>> On Friday, 6 September 2013 at 10:43:38 UTC, Iain Buclaw wrote:
>>>
>>> On 6 September 2013 10:35, eles <eles at eles.com> wrote:
>>
>> *p=3;
>> a=*p;
>>
>
> 'p' should be marked as 'shared' in this instance.

That will help, but it completely misleads. First, is not just 
about the data being shared, but it is about the hardware 
side-effect. If writing 3 to the *p register makes your 
front-panel LED to light up, you need to rely on the fact that 3 
is written (for real) at that address. And written when you ask 
it to be, not some 5 minutes later, because the compiler detected 
that no other thread accesses that variable, so decided to cache 
it. 5 minutes later the plane could be already landed. Without 
survivors.

"Shared" synchronizes within the D world. There is a world 
outside the D world, and I mean the hardware.


More information about the D.gnu mailing list