Something needs to happen with shared, and soon.

Jonathan M Davis jmdavisProg at gmx.com
Wed Nov 14 03:01:18 PST 2012


On Wednesday, November 14, 2012 11:49:22 Benjamin Thaut wrote:
> Am 14.11.2012 11:42, schrieb Walter Bright:
> > On 11/14/2012 1:23 AM, Benjamin Thaut wrote:
> >> Could you please give an example where it would break?
> > 
> > Thread 1:
> >    1. create shared object
> >    2. pass reference to that object to Thread 2
> >    3. destroy object
> > 
> > Thread 2:
> >    1. manipulate that object
> 
> But for passing a reference to a value type you would have to use a
> pointer, correct? And pointers are a unsafe feature anyway...
> I don't see your point.
> 
> And if the use of pointers is allowed, I can make the same case break in
> a single threaded environment without shared.

Pointers are not considered unsafe at all and are perfectly legal in SafeD. 
It's ponter _arithmetic_ which is unsafe and therefore considered to be 
@system.

- Jonathan M Davis


More information about the Digitalmars-d mailing list