-
-
Save heebinho/a1d5655901902db3c5399ecf38c9681c to your computer and use it in GitHub Desktop.
Mutating state from concurrent processes yields unpredictable results
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var list = Enumerable.Range(-1000,2001).Reverse().ToList(); | |
Action a1 = () => list.Sum().Dump(); | |
Action a2 = () => { list.Sort(); list.Sum().Dump(); }; | |
Parallel.Invoke(a1, a2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment