Skip to content

Commit 59a4c27

Browse files
Merge remote-tracking branch 'dhewm3/master'
2 parents fd0a99d + f2943c9 commit 59a4c27

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

neo/idlib/math/Simd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class idSIMD {
5757
===============================================================================
5858
*/
5959

60-
#ifdef _WIN32
60+
#if defined(_WIN32) && !defined(_WIN64)
6161
#define VPCALL __fastcall
6262
#else
6363
#define VPCALL

neo/sys/sys_public.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,11 @@ typedef int (*xthread_t)( void * );
381381
typedef struct {
382382
const char *name;
383383
SDL_Thread *threadHandle;
384+
#ifdef D3_SDL3
385+
uint64_t threadId;
386+
#else
384387
unsigned long threadId;
388+
#endif
385389
} xthreadInfo;
386390

387391
void Sys_CreateThread( xthread_t function, void *parms, xthreadInfo &info, const char *name );

neo/sys/threads.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ If you have questions concerning this license or the applicable additional terms
5151
#define SDL_CondSignal SDL_SignalCondition
5252
#endif
5353

54+
#if SDL_MAJOR_VERSION < 3
55+
// in SDL3 SDL_ThreadID is the type (that's called SDL_threadID with lowercase-t in SDL2),
56+
// in SDL1.2 and SDL2 SDL_ThreadID() is a function that returns the current thread's ID...
57+
// So use SDL_GetCurrentThreadID() in all cases to avoid this clash
58+
#define SDL_GetCurrentThreadID SDL_ThreadID
59+
#endif
60+
5461
#if __cplusplus >= 201103
5562
// xthreadinfo::threadId doesn't use SDL_threadID directly so we don't drag SDL headers into sys_public.h
5663
// but we should still make sure that the type fits (in SDL1.2 it's Uint32, in SDL2 it's unsigned long)
@@ -83,7 +90,7 @@ Sys_InitThreads
8390
==================
8491
*/
8592
void Sys_InitThreads() {
86-
mainThreadID = SDL_ThreadID();
93+
mainThreadID = SDL_GetCurrentThreadID();
8794
mainThreadIDset = true;
8895

8996
// critical sections
@@ -326,7 +333,7 @@ const char *Sys_GetThreadName(int *index) {
326333

327334
Sys_EnterCriticalSection();
328335

329-
SDL_threadID id = SDL_ThreadID();
336+
SDL_threadID id = SDL_GetCurrentThreadID();
330337

331338
for (int i = 0; i < thread_count; i++) {
332339
if (id == thread[i]->threadId) {
@@ -358,7 +365,7 @@ returns true if the current thread is the main thread
358365
*/
359366
bool Sys_IsMainThread() {
360367
if ( mainThreadIDset )
361-
return SDL_ThreadID() == mainThreadID;
368+
return SDL_GetCurrentThreadID() == mainThreadID;
362369
// if this is called before mainThreadID is set, we haven't created
363370
// any threads yet so it should be the main thread
364371
return true;

0 commit comments

Comments
 (0)