From 2256d0faddbc033a5fa03ded7cb289f5e240b108 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:56:44 +1100 Subject: [PATCH] Remove legacy Win32 thread entry state --- Minecraft.Client/Network/ServerChunkCache.cpp | 3 +-- Minecraft.World/Level/Storage/McRegionChunkStorage.cpp | 2 +- Minecraft.World/Level/Storage/McRegionChunkStorage.h | 2 +- Minecraft.World/Network/Connection.cpp | 7 ++----- Minecraft.World/Network/Connection.h | 7 ------- 5 files changed, 5 insertions(+), 16 deletions(-) diff --git a/Minecraft.Client/Network/ServerChunkCache.cpp b/Minecraft.Client/Network/ServerChunkCache.cpp index 2814d5f88..e05c890b1 100644 --- a/Minecraft.Client/Network/ServerChunkCache.cpp +++ b/Minecraft.Client/Network/ServerChunkCache.cpp @@ -664,7 +664,6 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) C4JThread::Event *wakeEvent[3]; // This sets off the threads that are waiting to continue C4JThread::Event *notificationEvent[3]; // These are signalled by the threads to let us know they are complete C4JThread *saveThreads[3]; - DWORD threadId[3]; SaveThreadData threadData[3]; ZeroMemory(&threadData[0], sizeof(SaveThreadData)); ZeroMemory(&threadData[1], sizeof(SaveThreadData)); @@ -739,7 +738,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) { char threadName[256]; sprintf(threadName,"Save thread %d\n",j); - SetThreadName(threadId[j], threadName); + SetThreadName(0, threadName); //saveThreads[j] = CreateThread(NULL,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]); saveThreads[j] = new C4JThread(runSaveThreadProc,(void *)&threadData[j],threadName); diff --git a/Minecraft.World/Level/Storage/McRegionChunkStorage.cpp b/Minecraft.World/Level/Storage/McRegionChunkStorage.cpp index b13f1c221..988b71be8 100644 --- a/Minecraft.World/Level/Storage/McRegionChunkStorage.cpp +++ b/Minecraft.World/Level/Storage/McRegionChunkStorage.cpp @@ -345,7 +345,7 @@ void McRegionChunkStorage::staticCtor() } } -int McRegionChunkStorage::runSaveThreadProc(LPVOID lpParam) +int McRegionChunkStorage::runSaveThreadProc(void *lpParam) { Compression::CreateNewThreadStorage(); diff --git a/Minecraft.World/Level/Storage/McRegionChunkStorage.h b/Minecraft.World/Level/Storage/McRegionChunkStorage.h index bcca14c8a..56fa2800c 100644 --- a/Minecraft.World/Level/Storage/McRegionChunkStorage.h +++ b/Minecraft.World/Level/Storage/McRegionChunkStorage.h @@ -39,5 +39,5 @@ public: private: static void WaitForAllSaves(); static void WaitForSaves(); - static int runSaveThreadProc(LPVOID lpParam); + static int runSaveThreadProc(void *lpParam); }; diff --git a/Minecraft.World/Network/Connection.cpp b/Minecraft.World/Network/Connection.cpp index 653f8ac24..a67ee7623 100644 --- a/Minecraft.World/Network/Connection.cpp +++ b/Minecraft.World/Network/Connection.cpp @@ -33,9 +33,6 @@ void Connection::_init() fakeLag = 0; slowWriteDelay = 50; - saqThreadID = 0; - closeThreadID = 0; - tickCount = 0; } @@ -380,7 +377,7 @@ void Connection::close(DisconnectPacket::eDisconnectReason reason, ...) // return( sum ? (sum / count) : 0 ); -// CreateThread(NULL, 0, runClose, this, 0, &closeThreadID); +// CreateThread(NULL, 0, runClose, this, 0, NULL); running = false; @@ -525,7 +522,7 @@ void Connection::sendAndQuit() close(DisconnectPacket::eDisconnect_Closed); } #else - CreateThread(NULL, 0, runSendAndQuit, this, 0, &saqThreadID); + CreateThread(NULL, 0, runSendAndQuit, this, 0, NULL); #endif } diff --git a/Minecraft.World/Network/Connection.h b/Minecraft.World/Network/Connection.h index 420f82358..c29bf9e71 100644 --- a/Minecraft.World/Network/Connection.h +++ b/Minecraft.World/Network/Connection.h @@ -19,11 +19,6 @@ class ByteArrayOutputStream; class Connection { - friend DWORD WINAPI runRead(LPVOID lpParam); - friend DWORD WINAPI runWrite(LPVOID lpParam); - friend DWORD WINAPI runSendAndQuit(LPVOID lpParam); - friend DWORD WINAPI runClose(LPVOID lpParam); - private: static const int SEND_BUFFER_SIZE = 1024 * 5; @@ -68,8 +63,6 @@ private: C4JThread::Event* m_hWakeReadThread; C4JThread::Event* m_hWakeWriteThread; - DWORD saqThreadID, closeThreadID; - bool disconnected; DisconnectPacket::eDisconnectReason disconnectReason; void **disconnectReasonObjects; // 4J a pointer to an array.