Exemplo n.º 1
0
bool ThreadSpec::NameMatches(Thread &thread) const {
  if (m_name.empty())
    return true;

  const char *name = thread.GetName();
  return NameMatches(name);
}
Exemplo n.º 2
0
void Scheduler::Schedule(registers_t* oldState)
{
    if(tm == NULL) return;
    //check if we have a timer manager
    ASSERT(tm != NULL, "TimerManager is NULL");
    
    SCHEDULER_DEBUG_MSG("Entering scheduler");
    CurrentHAL->DisableInterrupts();
    
    currentThread->SaveThreadContext(oldState);
    
    Thread *next;
    if(currentThread->next == NULL)
        next = listHead;
    else
        next = currentThread->next;

	SCHEDULER_DEBUG_MSG("Picking thread " << next->GetName());
	currentThread = next;
    
    currentThread->SetTimeslice(SCHED_THREAD_TIMESLICE);
    
    //printThreadInfo(currentThread->threadInfo);
    
    currentThread->SwitchTo();
}
Exemplo n.º 3
0
const char *GetThreadName()
{
	Thread *t = Thread::GetCurrent();
	
	if ( t == NULL )
		return gUnknownThread;
	
	return t->GetName();
}
Exemplo n.º 4
0
void Scheduler::DumpThreads(BaseDebugOutputDevice* c)
{
    for(Thread* curThread = listHead; curThread != NULL; curThread = curThread->next)
    {
        *c << "SCHEDULER: " << "\tThread ID: " << dec << curThread->GetId() << endl;
        *c << "SCHEDULER: " << "\tThread Name: " << curThread->GetName() << endl;
        *c << "SCHEDULER: " << "\tInstruction Pointer: " << hex << curThread->GetInstructionPointer() << endl;
        *c << "SCHEDULER: " << "\tStack Pointer: " << curThread->GetStackPointer() << endl;
        *c << "SCHEDULER: " << "\tBase Pointer: " << curThread->GetFramePointer() << endl;
        *c << "SCHEDULER: " << "\tTimeslice: " << dec << curThread->GetTimeslice() << endl;
        
        *c << endl;
    }
}