fix(compresssave): wait for async worker before closing save

This commit is contained in:
2026-08-05 03:30:38 +08:00
parent 732aceae4e
commit 009773f06b
5 changed files with 421 additions and 20 deletions
+3 -1
View File
@@ -68,6 +68,8 @@ public class DoubleBuffer(byte[] readingBuffer, byte[] writingBuffer, Action onR
private readonly Semaphore _readEnd = new(1, 1);
private readonly Semaphore _writeEnd = new(0, 1);
public bool HasPendingBuffer => _readBuffer != null;
public ByteSpan ReadBegin()
{
_writeEnd.WaitOne();
@@ -112,4 +114,4 @@ public class DoubleBuffer(byte[] readingBuffer, byte[] writingBuffer, Action onR
{
_writeEnd.Release();
}
}
}