Skip to content

Commit 484bc0a

Browse files
committed
xrGame: refactor get process ID on different platforms
1 parent 284c2ae commit 484bc0a

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

src/Common/PlatformLinux.inl

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,7 @@ inline char* _strupr_l(char* str, locale_t loc)
6868

6969
#define __except(X) catch(X)
7070

71-
/*
72-
static inline long InterlockedExchange(volatile long* val, long new_val)
73-
{
74-
long old_val;
75-
do {
76-
old_val = *val;
77-
} while (__sync_val_compare_and_swap (val, old_val, new_val) != old_val);
78-
return old_val;
79-
}
80-
*/
71+
#define GetCurrentProcessId getpid
8172

8273
inline pthread_t GetCurrentThreadId()
8374
{

src/xrGame/xrServer.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -829,11 +829,8 @@ void xrServer::Server_Client_Check(IClient* CL)
829829
{
830830
return;
831831
};
832-
#ifdef LINUX
833-
if (CL->process_id == getpid())
834-
#else
832+
835833
if (CL->process_id == GetCurrentProcessId())
836-
#endif
837834
{
838835
CL->flags.bLocal = 1;
839836
SV_Client = (xrClientData*)CL;
@@ -988,11 +985,7 @@ void xrServer::create_direct_client()
988985
SClientConnectData cl_data;
989986
cl_data.clientID.set(1);
990987
xr_strcpy(cl_data.name, "single_player");
991-
#ifdef LINUX
992-
cl_data.process_id = getpid();
993-
#else
994988
cl_data.process_id = GetCurrentProcessId();
995-
#endif
996989
new_client(&cl_data);
997990
}
998991

0 commit comments

Comments
 (0)