Value storage during Parallel Processing

后端 未结 1 923
盖世英雄少女心
盖世英雄少女心 2021-01-14 05:40

I just tried out this simple program... nothing fancy..

double[] a = new double[100000];
double[] b = new double[100000];

List a1 = new List&l         


        
相关标签:
1条回答
  • 2021-01-14 06:07

    List<T> is not thread-safe for multiple threads to be writing simultaneously, as described on the MSDN page. You must synchronize access (defeating the purpose of multiple threads) or use a thread-safe collection. There are thread-safe collections available in the System.Collections.Concurrent namespace.

    0 讨论(0)
提交回复
热议问题