Misc changes
[tpg/acess2.git] / AcessNative / acesskernel_src / threads.c
index 5f29f76..5a0ce13 100644 (file)
@@ -7,8 +7,9 @@
  */
 #define _SIGNAL_H_
 #undef CLONE_VM        // Such a hack
-#include <acess.h>
+#include <arch.h>
 #include <unistd.h>
+#include <sys/types.h>
 #include <stdint.h>
 #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];
 }
 

UCC git Repository :: git.ucc.asn.au