[dmd-concurrency] tail-shared by default?

Walter Bright walter at digitalmars.com
Fri Jan 8 18:00:35 PST 2010


All that's necessary is to take the address of a shared local and pass 
it to another thread:

   void foo()
   { shared int x;
      passToAnotherThread(&x);
      x++;     // <=== synchronization issues!
      waitForThreadToFinish();
    }

Steve Schveighoffer wrote:
> I don't think you read my points then.
>
> any shared reference type that is not global is tail-shared.  global variables are the only way to have head-shared references. I outline this clearly in the previous posts.
>
> -Steve
>
> On Fri Jan 8th, 2010 7:03 PM EST Walter Bright wrote:
>
>   
>> Steve Schveighoffer wrote:
>>     
>>> It's too bad that tail-const wouldn't work.  I don't think tail-shared presents the same problems.  Please don't dismiss all the points I wrote just because of past failures.  They are new ideas that don't apply to const at all.
>>>
>>>   
>>>       
>> They do apply. It is not about the semantic difference between const and shared, it is about the question "is this expression shared or not shared? const or not const?" How do I declare a type to be tail-shared? tail-const? Those questions must be unambiguously answered before you can apply semantics.
>>
>> In this context, tail-shared and tail-const are exactly the same problem.
>> _______________________________________________
>> dmd-concurrency mailing list
>> dmd-concurrency at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/dmd-concurrency
>>     
>
>
>
>       
> _______________________________________________
> dmd-concurrency mailing list
> dmd-concurrency at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-concurrency
>
>
>   


More information about the dmd-concurrency mailing list