Skip to content

Commit 7741943

Browse files
committed
Merge branch 'dev/v3.14.x-freeze-fix' into dev/v3.14.x
2 parents ce8fed1 + 1055624 commit 7741943

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

Assets/PatchKit Patcher/Scripts/AppData/Local/ThreadBufferedStream.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ public class ThreadBufferedStream : Stream
1010
private readonly Stream _innerStream;
1111
private readonly byte[] _buffer;
1212

13-
private Thread _readerThread;
14-
1513
private volatile bool _abort;
1614

1715
private readonly Semaphore _semaphore = new Semaphore(1, 1);
@@ -64,7 +62,7 @@ public override long Position
6462

6563
private void SpawnReaderThread()
6664
{
67-
_readerThread = new Thread(() =>
65+
ThreadPool.QueueUserWorkItem((x) =>
6866
{
6967
while (!_abort)
7068
{
@@ -93,12 +91,7 @@ private void SpawnReaderThread()
9391

9492
Thread.Sleep(1);
9593
}
96-
})
97-
{
98-
IsBackground = true
99-
};
100-
101-
_readerThread.Start();
94+
});
10295
}
10396

10497
public override int Read(byte[] buffer, int offset, int count)
@@ -205,7 +198,6 @@ public override void Close()
205198
{
206199
base.Close();
207200
_abort = true;
208-
if(_readerThread != null) _readerThread.Join();
209201
}
210202
}
211203
}

Assets/PatchKit Patcher/Scripts/Patcher.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,10 @@ private void StartThread()
374374
{
375375
DebugLogger.Log("Starting patcher thread...");
376376

377-
_thread = new Thread(() => ThreadExecution(_threadCancellationTokenSource.Token));
377+
_thread = new Thread(() => ThreadExecution(_threadCancellationTokenSource.Token))
378+
{
379+
IsBackground = true
380+
};
378381
_thread.Start();
379382
}
380383

Assets/PatchKit Patcher/Scripts/Utilities/Threading.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ public static IEnumerator StartThreadCoroutine<T>(Func<T> action, Action<T> onSu
3131
{
3232
exception = e;
3333
}
34-
});
34+
})
35+
{
36+
IsBackground = true
37+
};
3538

3639
try
3740
{

0 commit comments

Comments
 (0)