Threading Questions

bitwise via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 8 06:44:43 PDT 2015


On Thursday, 8 October 2015 at 10:11:38 UTC, Kagamin wrote:
> On Thursday, 8 October 2015 at 02:31:24 UTC, bitwise wrote:
>> If you have System.Collections.Generic.List(T) static class 
>> member, there is nothing wrong with using it from multiple 
>> threads like this:
>
> The equivalent of your D example would be
>
> class Foo {
>     static List<int> numbers = new List<int>();
>     void bar() {
>         new Thread(()=>{
>             numbers.Add(1);
>         }).Start();
>     }
> }

That still doesn't explain what you mean about it being illegal 
in other languages or why you brought up C# in the first place.

      Bit



More information about the Digitalmars-d-learn mailing list