Skip to content

Commit

Permalink
Merge pull request #84 from seionmoya/lock-logwrite
Browse files Browse the repository at this point in the history
Lock when writing
  • Loading branch information
seionmoya authored Oct 24, 2024
2 parents fe85758 + 5c4d861 commit 4b538ba
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Fuyu.Common/IO/Terminal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ namespace Fuyu.Common.IO
{
public static class Terminal
{
private static object _lock = new object();

public static void WriteLine(string text)
{
var line = $"{text}\n";

Console.Write(line);
WriteToFile(line);
lock (_lock)
{
Console.Write(line);
WriteToFile(line);
}
}

public static void WriteLine(object o)
Expand Down

0 comments on commit 4b538ba

Please sign in to comment.