extern void Proc_StartUser(Uint Entrypoint, Uint *Bases, int ArgC, char **ArgV, char **EnvP, int DataSize);
extern void Proc_CallFaultHandler(tThread *Thread);
extern void Proc_DumpThreadCPUState(tThread *Thread);
+extern void Proc_Reschedule(void);
extern tPAddr MM_ClearUser(void);
SHORTREL( &Thread->IsLocked ); // TODO: We may not actually be released...
// And, reschedule
- if(isCurThread) {
+ if(isCurThread)
+ {
for( ;; )
- HALT();
+ Proc_Reschedule();
}
}
*/
void Threads_Yield(void)
{
- tThread *thread = Proc_GetCurThread();
- thread->Remaining = 0;
- //while(thread->Remaining == 0)
- HALT();
+ Proc_Reschedule();
}
/**
// Release Spinlock
SHORTREL( &glThreadListLock );
-
- while(cur->Status != THREAD_STAT_ACTIVE) HALT();
+
+ while(cur->Status != THREAD_STAT_ACTIVE)
+ Proc_Reschedule();
}
if( gaThreads_NoTaskSwitch[CPU] )
return Last;
-
// Lock thread list
SHORTLOCK( &glThreadListLock );
// Make the new thread non-schedulable
thread->CurCPU = CPU;
+ thread->Remaining = thread->Quantum;
SHORTREL( &glThreadListLock );