revert of process limit (for now)

This commit is contained in:
pointfeev 2022-02-10 20:33:28 -05:00
parent b1a528799b
commit d8fcc1a88c

View file

@ -6,7 +6,6 @@ using System.IO.Compression;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
@ -29,16 +28,16 @@ internal static class SteamCMD
internal static readonly Version MinimumAppInfoVersion = Version.Parse("2.0.3.2");
internal static readonly string AppInfoVersionPath = AppInfoPath + @"\version.txt";
private static readonly int[] locks = new int[20]; // acts as an effective process limit
//private static readonly int[] locks = new int[20]; // acts as an effective process limit
internal static async Task<string> Run(string command) => await Task.Run(() =>
{
wait_for_lock:
/*wait_for_lock:
if (Program.Canceled) return "";
for (int i = 0; i < locks.Length; i++)
{
if (Program.Canceled) return "";
if (Interlocked.CompareExchange(ref locks[i], 1, 0) == 0)
{
{*/
if (Program.Canceled) return "";
List<string> logs = new();
ProcessStartInfo processStartInfo = new()
@ -60,12 +59,12 @@ internal static class SteamCMD
process.ErrorDataReceived += (object sender, DataReceivedEventArgs e) => logs.Add(e.Data);
process.BeginErrorReadLine();
process.WaitForExit();
Interlocked.Decrement(ref locks[i]);
//Interlocked.Decrement(ref locks[i]);
return string.Join("\r\n", logs);
/*}
Thread.Sleep(200);
}
Thread.Sleep(0);
}
goto wait_for_lock;
goto wait_for_lock;*/
});
internal static async Task Setup(IProgress<int> progress = null)