X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Finclude%2Fthreads.h;h=6c29230763d587f37f1c265543e77113ead4644e;hb=2ae2035466cfa7816079a067ccee25e2b8bac6bc;hp=2b066d9f338f917fdd2d4fdc813ea4bcbe9ad216;hpb=b98fbd4e9c71447d81fc9bd643fb174c76346e0f;p=tpg%2Facess2.git diff --git a/Kernel/include/threads.h b/Kernel/include/threads.h index 2b066d9f..6c292307 100644 --- a/Kernel/include/threads.h +++ b/Kernel/include/threads.h @@ -5,6 +5,7 @@ #include #include +#include typedef struct sMessage { @@ -17,13 +18,11 @@ typedef struct sMessage typedef struct sThread { // --- threads.c's - // 0 struct sThread *Next; //!< Next thread in list - tSpinlock IsLocked; //!< Thread's spinlock + tShortSpinlock IsLocked; //!< Thread's spinlock volatile int Status; //!< Thread Status int RetStatus; //!< Return Status - // 16 Uint TID; //!< Thread ID Uint TGID; //!< Thread Group (Process) Uint PTID; //!< Parent Thread ID @@ -31,20 +30,16 @@ typedef struct sThread char *ThreadName; //!< Name of thread // --- arch/proc.c's responsibility - // 40 //! Kernel Stack Base tVAddr KernelStack; - // 44 (x86) //! Memory Manager State tMemoryState MemState; - // 48 (x86) //! State on task switch tTaskState SavedState; // --- threads.c's - // 60 int CurFaultNum; //!< Current fault number, 0: none tVAddr FaultHandler; //!< Fault Handler @@ -55,6 +50,8 @@ typedef struct sThread int NumTickets; //!< Priority - Chance of gaining CPU Uint Config[NUM_CFG_ENTRIES]; //!< Per-process configuration + + volatile int CurCPU; } tThread; @@ -77,10 +74,14 @@ enum eFaultNumbers FAULT_FLOAT }; +#define GETMSG_IGNORE ((void*)-1) + // === FUNCTIONS === -extern tThread *Proc_GetCurThread(); +extern tThread *Proc_GetCurThread(void); extern tThread *Threads_GetThread(Uint TID); -extern void Threads_Wake(tThread *Thread); +extern void Threads_SetTickets(tThread *Thread, int Num); +extern int Threads_Wake(tThread *Thread); extern void Threads_AddActive(tThread *Thread); +extern tThread *Threads_GetNextToRun(int CPU, tThread *Last); #endif