X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fthreads.c;h=a81736b19bcfdee96eb17a8ce1b9fcec9f7010e4;hb=c43c05ef3234d6118ce601d299df60383d54ac7b;hp=f84ca7c20a825bf6c3787219998bc58996c4cb0d;hpb=3ae2945f389308e0fab4f63980e8152577c17bf8;p=tpg%2Facess2.git diff --git a/Kernel/threads.c b/Kernel/threads.c index f84ca7c2..a81736b1 100644 --- a/Kernel/threads.c +++ b/Kernel/threads.c @@ -904,14 +904,17 @@ void Threads_AddActive(tThread *Thread) /** * \brief Removes the current thread from the active queue - * \warning This should ONLY be called with task switches disabled + * \warning This should ONLY be called with the lock held * \return Current thread pointer */ tThread *Threads_RemActive(void) { tThread *ret = Proc_GetCurThread(); - - SHORTLOCK( &glThreadListLock ); + + if( !IS_LOCKED(&glThreadListLock) ) { + Log_KernelPanic("Threads", "Threads_RemActive called without lock held"); + return NULL; + } // Delete from active queue #if SCHEDULER_TYPE == SCHED_RR_PRI @@ -938,8 +941,6 @@ tThread *Threads_RemActive(void) GetCPUNum(), ret, ret->TID, ret->ThreadName, giFreeTickets); #endif - SHORTREL( &glThreadListLock ); - return ret; } @@ -1312,6 +1313,9 @@ tThread *Threads_GetNextToRun(int CPU, tThread *Last) SHORTREL(&glThreadListLock); return NULL; } + if( thread->Status != THREAD_STAT_ACTIVE ) { + LogF("Oops, Thread %i (%s) is not active\n", thread->TID, thread->ThreadName); + } } #elif SCHEDULER_TYPE == SCHED_RR_SIM {