Browse Source

Use ManualResetEventSlim instead

pull/65/head
Meivyn 1 year ago
parent
commit
cb44b792c8
No known key found for this signature in database GPG Key ID: 8BDD3E48158B2F71
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      IPA.Loader/Logging/StdoutInterceptorPipes.cs

+ 4
- 2
IPA.Loader/Logging/StdoutInterceptorPipes.cs View File

@ -11,7 +11,7 @@ namespace IPA.Logging
{
// Used to ensure the server starts first, as Mono struggles with this simple task.
// Otherwise it would throw a ERROR_PIPE_CONNECTED Win32Exception.
private static readonly ManualResetEvent manualResetEvent = new(false);
private static readonly ManualResetEventSlim manualResetEvent = new(false);
public static bool ShouldRedirectStdHandles;
@ -58,6 +58,7 @@ namespace IPA.Logging
{
Console.WriteLine(ex);
pipeServer.Close();
manualResetEvent.Dispose();
}
});
}
@ -71,7 +72,7 @@ namespace IPA.Logging
try
{
// If the client starts first, blocks the client thread.
manualResetEvent.WaitOne();
manualResetEvent.Wait();
pipeClient.Connect();
SetStdHandle(stdHandle, pipeClient.SafePipeHandle.DangerousGetHandle());
while (pipeClient.IsConnected)
@ -83,6 +84,7 @@ namespace IPA.Logging
{
Console.WriteLine(ex);
pipeClient.Close();
manualResetEvent.Dispose();
}
});
}


Loading…
Cancel
Save