Something needs to happen with shared, and soon.

Sean Kelly sean at invisibleduck.org
Thu Nov 15 08:31:40 PST 2012


On Nov 11, 2012, at 6:30 PM, Walter Bright <newshound2 at digitalmars.com> wrote:
> 
> To make a shared type work in an algorithm, you have to:
> 
> 1. ensure single threaded access by aquiring a mutex
> 2. cast away shared
> 3. operate on the data
> 4. cast back to shared
> 5. release the mutex


So what happens if you pass a reference to the now non-shared object to a function that caches a local reference to it?  Half the point of the attribute is to protect us from accidents like this.


More information about the Digitalmars-d mailing list