cur->Quantum = 1; // 1 slice quantum
HALT();
for(;;) {
- //Log("---- Idle");
- //Threads_Dump();
HALT(); // Just yeilds
}
}
* \brief Wait for a task to change state
*/
int Threads_WaitTID(int TID, int *status)
-{
- Threads_Dump();
-
+{
// Any Child
if(TID == -1) {
*/
void Threads_Exit(int TID, int Status)
{
- Threads_Kill( Proc_GetCurThread(), (Uint)Status & 0xFF );
+ if( TID == 0 )
+ Threads_Kill( Proc_GetCurThread(), (Uint)Status & 0xFF );
+ else
+ Threads_Kill( Threads_GetThread(TID), (Uint)Status & 0xFF );
}
/**
tMsg *msg;
// Kill all children
- #if 0
+ #if 1
{
tThread *child;
for(child = gActiveThreads;
child;
child = child->Next)
{
- if(child->PTID == gCurrentThread->TID)
+ if(child->PTID == Thread->TID)
Threads_Kill(child, -1);
}
}
/**
* \fn void Threads_SendSignal(int TID, int Num)
+ * \brief Send a signal to a thread
*/
void Threads_SendSignal(int TID, int Num)
{
return gActiveThreads;
}
- Log(" Threads_GetNextToRun: giNumActiveThreads=%i,giTotalTickets=%i",
- giNumActiveThreads, giTotalTickets);
+ //Log(" Threads_GetNextToRun: giNumActiveThreads=%i,giTotalTickets=%i",
+ // giNumActiveThreads, giTotalTickets);
// Get the ticket number
ticket = number = rand() % giTotalTickets;
- Log(" Threads_GetNextToRun: ticket = %i", ticket);
+ //Log(" Threads_GetNextToRun: ticket = %i", ticket);
// Find the next thread
for(thread=gActiveThreads;thread;thread=thread->Next)
return thread;
}
+
+/**
+ * \fn void Threads_SegFault(tVAddr Addr)
+ * \brief Called when a Segment Fault occurs
+ */
+void Threads_SegFault(tVAddr Addr)
+{
+ //Threads_SendSignal( Proc_GetCurThread()->TID, SIGSEGV );
+ Threads_Kill( Proc_GetCurThread(), 0 );
+}