[Issue 9163] std.parallelism broken with extensive optimizations (gdc)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 16 02:37:19 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=9163


Iain Buclaw <ibuclaw at ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw at ubuntu.com


--- Comment #2 from Iain Buclaw <ibuclaw at ubuntu.com> 2012-12-16 02:36:57 PST ---
The read/writes just need to be safeguarded by synchronized to prevent any
memoization occuring.


private void atomicSetUbyte(ref ubyte stuff, ubyte newVal)
{
  synchronized atomicStore(*(cast(shared) &stuff), newVal);
}

private ubyte atomicReadUbyte(ref ubyte val)
{
  synchronized return atomicLoad(*(cast(shared) &val));
}

private bool atomicCasUbyte(ref ubyte stuff, ubyte testVal, ubyte newVal)
{
  synchronized return core.atomic.cas(cast(shared) &stuff, testVal, newVal);
}



I don't think the use of volatile statements/variables may help here...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list