fix: Fixes libdeflate threading issue (#1813)
This commit is contained in:
parent
aeba2261d2
commit
a8d3d2773e
2 changed files with 8 additions and 11 deletions
|
|
@ -20,16 +20,8 @@ namespace Server.Compression;
|
|||
|
||||
public static class Deflate
|
||||
{
|
||||
public static LibDeflateBinding Standard { get; }
|
||||
[ThreadStatic]
|
||||
private static LibDeflateBinding _standard;
|
||||
|
||||
static Deflate()
|
||||
{
|
||||
Standard = new LibDeflateBinding();
|
||||
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
|
||||
}
|
||||
|
||||
private static void CurrentDomain_ProcessExit(object sender, EventArgs e)
|
||||
{
|
||||
Standard.Dispose();
|
||||
}
|
||||
public static LibDeflateBinding Standard => _standard ??= new LibDeflateBinding();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue