Skip to content

Commit

Permalink
Linux: fixed thread detection
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleivg committed Nov 8, 2018
1 parent 484bc0a commit 81bc1e8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
7 changes: 2 additions & 5 deletions src/Common/PlatformLinux.inl
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,9 @@ inline char* _strupr_l(char* str, locale_t loc)

#define __except(X) catch(X)

#define tid_t pthread_t
#define GetCurrentProcessId getpid

inline pthread_t GetCurrentThreadId()
{
return pthread_self();
}
#define GetCurrentThreadId pthread_self

inline void Sleep(int ms)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Common/PlatformWindows.inl
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@

inline void convert_path_separators(char * path) {}
inline void restore_path_separators(char * path) {}

#define tid_t DWORD
2 changes: 1 addition & 1 deletion src/xrEngine/xr_object_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ENGINE_API CObjectList
Objects objects_active;
Objects objects_sleeping;
Objects m_crows[2];
u32 m_owner_thread_id;
tid_t m_owner_thread_id;
ObjectUpdateStatistics stats;
u32 statsFrame;

Expand Down
6 changes: 5 additions & 1 deletion src/xrGame/Level_Bullet_Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ void CBulletManager::AddBullet(const Fvector& position, const Fvector& direction
float impulse, u16 sender_id, u16 sendersweapon_id, ALife::EHitType e_hit_type, float maximum_distance,
const CCartridge& cartridge, float const air_resistance_factor, bool SendHit, bool AimBullet)
{
#ifdef DEBUG
VERIFY(m_thread_id == GetCurrentThreadId());
#endif

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

void CBulletManager::UpdateWorkload()
{
// VERIFY ( m_thread_id == GetCurrentThreadId() );
#ifdef DEBUG
VERIFY ( m_thread_id == GetCurrentThreadId() );
#endif

rq_storage.r_clear();

Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Level_Bullet_Manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class CBulletManager
xr_vector<_event> m_Events;

#ifdef DEBUG
u32 m_thread_id;
tid_t m_thread_id;

typedef xr_vector<Fvector> BulletPoints;
BulletPoints m_bullet_points;
Expand Down

0 comments on commit 81bc1e8

Please sign in to comment.