Skip to content

Commit 81bc1e8

Browse files
committed
Linux: fixed thread detection
1 parent 484bc0a commit 81bc1e8

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

src/Common/PlatformLinux.inl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,9 @@ inline char* _strupr_l(char* str, locale_t loc)
6868

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

71+
#define tid_t pthread_t
7172
#define GetCurrentProcessId getpid
72-
73-
inline pthread_t GetCurrentThreadId()
74-
{
75-
return pthread_self();
76-
}
73+
#define GetCurrentThreadId pthread_self
7774

7875
inline void Sleep(int ms)
7976
{

src/Common/PlatformWindows.inl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@
3535

3636
inline void convert_path_separators(char * path) {}
3737
inline void restore_path_separators(char * path) {}
38+
39+
#define tid_t DWORD

src/xrEngine/xr_object_list.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ENGINE_API CObjectList
3939
Objects objects_active;
4040
Objects objects_sleeping;
4141
Objects m_crows[2];
42-
u32 m_owner_thread_id;
42+
tid_t m_owner_thread_id;
4343
ObjectUpdateStatistics stats;
4444
u32 statsFrame;
4545

src/xrGame/Level_Bullet_Manager.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ void CBulletManager::AddBullet(const Fvector& position, const Fvector& direction
183183
float impulse, u16 sender_id, u16 sendersweapon_id, ALife::EHitType e_hit_type, float maximum_distance,
184184
const CCartridge& cartridge, float const air_resistance_factor, bool SendHit, bool AimBullet)
185185
{
186+
#ifdef DEBUG
186187
VERIFY(m_thread_id == GetCurrentThreadId());
188+
#endif
187189

188190
VERIFY(u16(-1) != cartridge.bullet_material_idx);
189191
// u32 CurID = Level().CurrentControlEntity()->ID();
@@ -206,7 +208,9 @@ void CBulletManager::AddBullet(const Fvector& position, const Fvector& direction
206208

207209
void CBulletManager::UpdateWorkload()
208210
{
209-
// VERIFY ( m_thread_id == GetCurrentThreadId() );
211+
#ifdef DEBUG
212+
VERIFY ( m_thread_id == GetCurrentThreadId() );
213+
#endif
210214

211215
rq_storage.r_clear();
212216

src/xrGame/Level_Bullet_Manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class CBulletManager
137137
xr_vector<_event> m_Events;
138138

139139
#ifdef DEBUG
140-
u32 m_thread_id;
140+
tid_t m_thread_id;
141141

142142
typedef xr_vector<Fvector> BulletPoints;
143143
BulletPoints m_bullet_points;

0 commit comments

Comments
 (0)