From ed9301f3f8980fc28757285c33471b212fffeca3 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 15 May 2021 22:56:44 -0500 Subject: [PATCH] Join the input thread without interrupting first Otherwise we'll kill it before it finishes draining --- src/InputStream.c | 6 ++---- src/Platform.c | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/InputStream.c b/src/InputStream.c index 734ed15..4601913 100644 --- a/src/InputStream.c +++ b/src/InputStream.c @@ -364,14 +364,12 @@ int stopInputStream(void) { // Signal the input send thread to drain all pending // input packets before shutting down. LbqSignalQueueDrain(&packetQueue); + PltJoinThread(&inputSendThread); + PltCloseThread(&inputSendThread); if (inputSock != INVALID_SOCKET) { shutdownTcpSocket(inputSock); } - - PltInterruptThread(&inputSendThread); - PltJoinThread(&inputSendThread); - PltCloseThread(&inputSendThread); if (inputSock != INVALID_SOCKET) { closeSocket(inputSock); diff --git a/src/Platform.c b/src/Platform.c index 02000b2..8b57493 100644 --- a/src/Platform.c +++ b/src/Platform.c @@ -167,7 +167,6 @@ void PltUnlockMutex(PLT_MUTEX* mutex) { } void PltJoinThread(PLT_THREAD* thread) { - LC_ASSERT(thread->cancelled); #if defined(LC_WINDOWS) WaitForSingleObjectEx(thread->handle, INFINITE, FALSE); #elif defined(__vita__)