Something needs to happen with shared, and soon.

Walter Bright newshound2 at digitalmars.com
Wed Nov 14 02:42:04 PST 2012


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


> And whats the difference between:
>
> struct Value
> {
>    ~this()
>    {
>      printf("destroy\n");
>    }
> }
>
> shared Value v;
>
>
> and:
>
>
> shared static ~this()
> {
>    printf("destory\n");
> }

The struct declaration of ~this() has no idea what context it will be used in.



More information about the Digitalmars-d mailing list