Allow the input queue to drain before terminating the thread

This ensures any final input messages (like key ups) make it to the host
This commit is contained in:
Cameron Gutman committed 2021-05-15 22:01:50 -05:00
1 parent 71c9ff0d91
commit 431e188b07
3 files changed
+57 -17

No files matched your search

+4 -3
View File
@@ -361,14 +361,15 @@ int stopInputStream(void) {
// No more packets should be queued now
initialized = false;
// Signal the input send thread
LbqSignalQueueShutdown(&packetQueue);
PltInterruptThread(&inputSendThread);
// Signal the input send thread to drain all pending
// input packets before shutting down.
LbqSignalQueueDrain(&packetQueue);
if (inputSock != INVALID_SOCKET) {
shutdownTcpSocket(inputSock);
}
PltInterruptThread(&inputSendThread);
PltJoinThread(&inputSendThread);
PltCloseThread(&inputSendThread);