X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=AcessNative%2Facesskernel_src%2Fthreads.c;h=5a0ce131cacb6a7fcd9f1c2d749d1179cc9f8f97;hb=adbdc45e64c40f7d3a022caedeb22f5e95dcd12a;hp=5f29f7601346a2fabb3ea2383d97574c32aad339;hpb=c0758a3d1053010f2c6f122365acde3efda2ba77;p=tpg%2Facess2.git diff --git a/AcessNative/acesskernel_src/threads.c b/AcessNative/acesskernel_src/threads.c index 5f29f760..5a0ce131 100644 --- a/AcessNative/acesskernel_src/threads.c +++ b/AcessNative/acesskernel_src/threads.c @@ -7,8 +7,9 @@ */ #define _SIGNAL_H_ #undef CLONE_VM // Such a hack -#include +#include #include +#include #include #include "/usr/include/signal.h" @@ -44,8 +45,12 @@ typedef struct sThread } tThread; // === GLOBALS === -tThread *gpThreads; -__thread tThread *gpCurrentThread; +tThread gThread_Zero = { + State: 1, + ThreadName: "ThreadZero" +}; +tThread *gpThreads = &gThread_Zero; +__thread tThread *gpCurrentThread = &gThread_Zero; // === CODE === tThread *Threads_GetThread(int TID) @@ -62,10 +67,17 @@ tThread *Threads_GetThread(int TID) tUID Threads_GetUID() { return gpCurrentThread->UID; } tGID Threads_GetGID() { return gpCurrentThread->GID; } tTID Threads_GetTID() { return gpCurrentThread->TID; } -tPID Threads_GetPID() { return gpCurrentThread->PID; } +tPID Threads_GetPID() { + return SDL_ThreadID(); + //return gpCurrentThread->PID; +} Uint *Threads_GetCfgPtr(int Index) { + if( Index < 0 || Index >= NUM_CFG_ENTRIES ) + return NULL; + if( !gpCurrentThread ) + return NULL; return &gpCurrentThread->Config[Index]; }