int number;
if(giNumActiveThreads == 0) {
- //Log_Debug("Threads", "CPU%i has no threads to run", CPU);
return NULL;
}
// Special case: 1 thread
if(giNumActiveThreads == 1) {
- //Log_Debug("Threads", "CPU%i has only one thread %i %s",
- // CPU, gActiveThreads->TID, gActiveThreads->ThreadName);
return gActiveThreads;
}
- //Log(" Threads_GetNextToRun: giNumActiveThreads=%i,giTotalTickets=%i",
- // giNumActiveThreads, giTotalTickets);
// Get the ticket number
ticket = number = rand() % giTotalTickets;
- //Log(" Threads_GetNextToRun: ticket = %i", ticket);
-
// Find the next thread
for(thread=gActiveThreads;thread;thread=thread->Next)
{
giTotalTickets, number);
}
- //Log_Debug("Threads", "Switching CPU%i to %p (%s)",
- // CPU, thread, thread->ThreadName);
-
return thread;
}