May 16, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8077


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |INVALID


--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2012-05-16 11:06:45 PDT ---
I'm going to argue that although the code compiled in 2.057, it was not correct and had latent concurrency bugs. The problems are:

1. being shared doesn't mean that assignments to an array are atomic

2. there is no obvious place to put a lock around updating a shared resource like a shared array

3. locks can be very, very slow. Shared does not mean "automatically insert locks"

Therefore, I'm going to mark this as invalid.

In essence, you (the programmer) has to decide how to manage the memory is to be controlled by a shared array. You can allocate an array as thread local, then cast it to shared as a last step (probably the best approach). If the array is already shared, you'll have to protect the resize with a lock that fits in with your data structure.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 16, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8077



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-05-16 11:30:15 PDT ---
Well I thought shared was going to become some sort of gateway to safe-by-default concurrent programming, I guessed wrong.

This section needs to be updated (by someone who knows exactly what shared
does):
http://dlang.org/attribute.html#shared

Some partial information is here: http://dlang.org/migrate-to-shared.html#shared

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