|
|
|
|
|
by snak
1943 days ago
|
|
Yes, I do agree C# does have many constructs (Parallel For/ForEach/Invoke...) but there's many things to consider that are not designed with thread safety in mind (e.g. generic collections, List<T>, Dictionary<T>, etc... must be replaced by their System.Collections.Concurrent respectives) and many other risks that parallel computing poses. int x = 0;
Parallel.For(0, 99999, z => {
x++;
});
Console.WriteLine(x);
Something as simple as an integer sum won't produce the expected output unless you're using Interlocked increments.And that definetely does not match what oblio means with "have the programming language Do The Right Thing with no further hassle". |
|