Fixed 10-15% idle CPU load by removing log dequeue loop

This commit is contained in:
N00MKRAD
2021-05-13 22:31:13 +02:00
parent 4b12437feb
commit 7b0498f4fc
2 changed files with 5 additions and 11 deletions

View File

@@ -39,21 +39,16 @@ namespace Flowframes
public static void Log(string msg, bool hidden = false, bool replaceLastLine = false, string filename = "")
{
logQueue.Enqueue(new LogEntry(msg, hidden, replaceLastLine, filename));
ShowNext();
}
public static async Task Run()
{
while (true)
{
if (!logQueue.IsEmpty)
public static void ShowNext ()
{
LogEntry entry;
if (logQueue.TryDequeue(out entry))
Show(entry);
}
}
}
public static void Show(LogEntry entry)
{

View File

@@ -31,7 +31,6 @@ namespace Flowframes
IOUtils.DeleteContentsOfDir(Paths.GetLogPath()); // Clear out older logs from previous session
Networks.Init();
Task.Run(() => Logger.Run());
Task.Run(() => DiskSpaceCheckLoop());
Application.EnableVisualStyles();