From d359c0af4874534efa810729d47f610a29687e93 Mon Sep 17 00:00:00 2001 From: fusion32 Date: Sat, 19 Jul 2025 11:35:11 -0300 Subject: THREADING: upgrade from LinuxThreads to NPTL This was a required change to make the server run on a modern GLIBC version without resorting to shady shared libraries or compatibility tricks. It is very straightforward but we should always keep an eye out for possible bugs. There was also a problem with the Z loop on field sending functions that was causing the server to hang in an infinite loop and should now be fixed. With these changes it is now possible to login into the game for a split second before the client asserting. --- src/crplayer.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/crplayer.cc') diff --git a/src/crplayer.cc b/src/crplayer.cc index dce7ad2..8ecc926 100644 --- a/src/crplayer.cc +++ b/src/crplayer.cc @@ -732,7 +732,7 @@ void TPlayer::TakeOver(TConnection *Connection){ return; } - if(PlayerData->Locked != getpid()){ + if(PlayerData->Locked != gettid()){ error("TPlayer::TakeOver: PlayerData-Slot ist nicht korrekt gesperrt (%d).\n", PlayerData->Locked); } @@ -2639,7 +2639,7 @@ void FreePlayerPoolSlot(TPlayerData *Slot){ return; } - if(Slot->Locked != 0 && Slot->Locked != getpid()){ + if(Slot->Locked != 0 && Slot->Locked != gettid()){ error("FreePlayerPoolSlot: Slot ist von einem anderen Thread gesperrt.\n"); return; } @@ -2693,7 +2693,7 @@ TPlayerData *AssignPlayerPoolSlot(uint32 CharacterID, bool DontWait){ } if(Slot->Locked == 0){ - Slot->Locked = getpid(); + Slot->Locked = gettid(); PlayerDataPoolMutex.up(); return Slot; } @@ -2753,7 +2753,7 @@ TPlayerData *AssignPlayerPoolSlot(uint32 CharacterID, bool DontWait){ memset(Slot, 0, sizeof(TPlayerData)); Slot->CharacterID = CharacterID; - Slot->Locked = getpid(); + Slot->Locked = gettid(); PlayerDataPoolMutex.up(); print(3, "Lade Daten für Spieler %u.\n", CharacterID); @@ -2792,7 +2792,7 @@ TPlayerData *AttachPlayerPoolSlot(uint32 CharacterID, bool DontWait){ } if(Slot->Locked == 0){ - Slot->Locked = getpid(); + Slot->Locked = gettid(); PlayerDataPoolMutex.up(); return Slot; } @@ -2817,7 +2817,7 @@ void AttachPlayerPoolSlot(TPlayerData *Slot, bool DontWait){ while(true){ PlayerDataPoolMutex.down(); if(Slot->Locked == 0){ - Slot->Locked = getpid(); + Slot->Locked = gettid(); PlayerDataPoolMutex.up(); return; } @@ -2882,7 +2882,7 @@ void ReleasePlayerPoolSlot(TPlayerData *Slot){ return; } - if(Slot->Locked != getpid()){ + if(Slot->Locked != gettid()){ error("ReleasePlayerPoolSlot: Slot ist von einem anderen Thread gesperrt.\n"); return; } @@ -2908,7 +2908,7 @@ void SavePlayerPoolSlots(void){ } AttachPlayerPoolSlot(Slot, true); - if(Slot->Locked == getpid()){ + if(Slot->Locked == gettid()){ SavePlayerPoolSlot(Slot); ReleasePlayerPoolSlot(Slot); } -- cgit v1.2.3