TPL を使用すると、Parse で問題が発生します。メソッドは、Console.Write を使用して Line を作成しますが、1 つを高速にして他のメソッド行に書き込むことがあります。どうすればロックできますか、またはもっと良い方法がありますか?
Parallel.Invoke(
() => insertedOne = Lib.ParseOne(list),
() => insertedTwo = Lib.ParseTwo(list),
() => insertedThree = Lib.ParseThree(list));
解析の例.. メソッド。
public static int ParseOne(string[] _list) {
Console.Write("blabla");
Console.Write("blabla");
return 0;
}
public static int ParseTwo(string[] _list) {
Console.Write("hahahah");
Console.Write("hahahah");
return 0;
}
public static int ParseThree(string[] _list) {
Console.Write("egegege");
Console.Write("egegege");
return 0;
}