using System.Threading.Tasks;
public static void Main()
var updateOne = Task.Run(() => UpdateValue(1000000, 1));
var updateTwo = Task.Run(() => UpdateValue(1000000, -1));
var updateThree = Task.Run(() => UpdateValue(1000000, 1));
Task.WaitAll(updateOne, updateTwo, updateThree);
Console.WriteLine($"Value: {_value}");
void UpdateValue(int maxLoops, int amount)
for (var i = 0; i < maxLoops; i++)