diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2025-07-19 11:35:11 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2025-07-19 11:35:11 -0300 |
| commit | d359c0af4874534efa810729d47f610a29687e93 (patch) | |
| tree | 9a89b06444819e7e5cef84aa826682b3b01bfd03 /src/shm.cc | |
| parent | 638244fd078fe91971e57b1d06e4499268d99c42 (diff) | |
| download | game-d359c0af4874534efa810729d47f610a29687e93.tar.gz game-d359c0af4874534efa810729d47f610a29687e93.zip | |
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.
Diffstat (limited to 'src/shm.cc')
| -rw-r--r-- | src/shm.cc | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -23,7 +23,8 @@ struct TSharedMemory { int PrintBufferPosition; char PrintBuffer[200][128]; GAMESTATE GameState; - pid_t GameThreadPID; + pid_t GameProcessID; + pid_t GameThreadID; }; static TSharedMemory *SHM = NULL; @@ -101,10 +102,18 @@ bool GameEnding(void){ return Result; } -pid_t GetGameThreadPID(void){ +pid_t GetGameProcessID(void){ pid_t Pid = 0; if(SHM != NULL){ - Pid = SHM->GameThreadPID; + Pid = SHM->GameProcessID; + } + return Pid; +} + +pid_t GetGameThreadID(void){ + pid_t Pid = 0; + if(SHM != NULL){ + Pid = SHM->GameThreadID; } return Pid; } @@ -372,7 +381,8 @@ void InitSHM(bool Verbose){ SHM->PrintBufferPosition = 1; SHM->GameState = GAME_STARTING; - SHM->GameThreadPID = getpid(); + SHM->GameProcessID = getpid(); + SHM->GameThreadID = gettid(); } void ExitSHM(void){ |
