X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=KernelLand%2FKernel%2Fthreads.c;h=1781f69923440ef8a4e4f8f0ff2c84a170fef726;hb=6b5fe5c5491e925bb1dd0d0650eeafd363538b1a;hp=21dc055f3e6abef59d660a87513b5b31b17b5a9b;hpb=5117f5901dfec46d535a7685d1904f802d21d62f;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/threads.c b/KernelLand/Kernel/threads.c index 21dc055f..1781f699 100644 --- a/KernelLand/Kernel/threads.c +++ b/KernelLand/Kernel/threads.c @@ -49,7 +49,7 @@ void Threads_Delete(tThread *Thread); char *Threads_GetName(tTID ID); #if 0 void Threads_SetPriority(tThread *Thread, int Pri); -tThread *Threads_CloneTCB(Uint *Err, Uint Flags); +tThread *Threads_CloneTCB(Uint Flags); int Threads_WaitTID(int TID, int *status); tThread *Threads_GetThread(Uint TID); #endif @@ -59,9 +59,7 @@ void Threads_int_AddToList(tThreadList *List, tThread *Thread); void Threads_Exit(int TID, int Status); void Threads_Kill(tThread *Thread, int Status); void Threads_Yield(void); -#endif -void Threads_int_Sleep(enum eThreadStatus Status, void *Ptr, int Num, tThread **ListHead, tThread **ListTail, tShortSpinlock *Lock); -#if 0 + int Threads_int_Sleep(enum eThreadStatus Status, void *Ptr, int Num, tThread **ListHead, tThread **ListTail, tShortSpinlock *Lock); void Threads_Sleep(void); int Threads_Wake(tThread *Thread); void Threads_AddActive(tThread *Thread); @@ -754,7 +752,7 @@ void Threads_int_WaitForStatusEnd(enum eThreadStatus Status) } } -void Threads_int_Sleep(enum eThreadStatus Status, void *Ptr, int Num, tThread **ListHead, tThread **ListTail, tShortSpinlock *Lock) +int Threads_int_Sleep(enum eThreadStatus Status, void *Ptr, int Num, tThread **ListHead, tThread **ListTail, tShortSpinlock *Lock) { SHORTLOCK( &glThreadListLock ); tThread *us = Threads_RemActive(); @@ -768,12 +766,11 @@ void Threads_int_Sleep(enum eThreadStatus Status, void *Ptr, int Num, tThread ** if( ListTail ) { if(*ListTail) { (*ListTail)->Next = us; - *ListTail = us; } else { *ListHead = us; - *ListTail = us; } + *ListTail = us; } else { *ListHead = us; @@ -783,8 +780,10 @@ void Threads_int_Sleep(enum eThreadStatus Status, void *Ptr, int Num, tThread ** // return ; SHORTREL( &glThreadListLock ); if( Lock ) - SHORTLOCK( Lock ); + SHORTREL( Lock ); Threads_int_WaitForStatusEnd(Status); + us->WaitPointer = NULL; + return us->RetStatus; } /**