Lines Matching refs:thread

14 /*! The thread scheduler */
46 void operator()(ThreadData* thread);
78 static void enqueue(Thread* thread, bool newOne);
82 ThreadEnqueuer::operator()(ThreadData* thread)
84 enqueue(thread->GetThread(), false);
89 scheduler_dump_thread_data(Thread* thread)
91 thread->scheduler_data->Dump();
96 enqueue(Thread* thread, bool newOne)
100 ThreadData* threadData = thread->scheduler_data;
103 T(EnqueueThread(thread, threadPriority));
107 if (thread->pinned_to_cpu > 0) {
108 ASSERT(thread->previous_cpu != NULL);
110 targetCPU = &gCPUEntries[thread->previous_cpu->cpu_num];
120 TRACE("enqueueing thread %ld with priority %ld on CPU %ld (core %ld)\n",
121 thread->id, threadPriority, targetCPU->ID(), targetCore->ID());
128 thread);
145 /*! Enqueues the thread into the run queue.
146 Note: thread lock must be held when entering this function
149 scheduler_enqueue_in_run_queue(Thread *thread)
156 TRACE("enqueueing new thread %ld with static priority %ld\n", thread->id,
157 thread->priority);
159 ThreadData* threadData = thread->scheduler_data;
164 enqueue(thread, true);
168 /*! Sets the priority of a thread.
171 scheduler_set_thread_priority(Thread *thread, int32 priority)
175 InterruptsSpinLocker _(thread->scheduler_lock);
180 ThreadData* threadData = thread->scheduler_data;
181 int32 oldPriority = thread->priority;
183 TRACE("changing thread %ld priority to %ld (old: %ld, effective: %ld)\n",
184 thread->id, priority, oldPriority, threadData->GetEffectivePriority());
186 thread->priority = priority;
192 if (thread->state != B_THREAD_READY) {
193 if (thread->state == B_THREAD_RUNNING) {
196 ASSERT(thread->cpu != NULL);
197 CPUEntry* cpu = &gCPUEntries[thread->cpu->cpu_num];
206 // The thread is in the run queue. We need to remove it and re-insert it at
209 T(RemoveThread(thread));
213 thread);
216 enqueue(thread, true);
245 continue_cpu_timers(Thread* thread, cpu_ent* cpu)
247 SpinLocker teamLocker(&thread->team->time_lock);
248 SpinLocker threadLocker(&thread->time_lock);
250 if (thread->HasActiveCPUTimeUserTimers()
251 || thread->team->HasActiveCPUTimeUserTimers()) {
252 user_timer_continue_cpu_timers(thread, cpu->previous_thread);
258 thread_resumes(Thread* thread)
260 cpu_ent* cpu = thread->cpu;
265 continue_cpu_timers(thread, cpu);
268 if ((thread->flags & THREAD_FLAGS_DEBUGGER_INSTALLED) != 0)
269 user_debug_thread_scheduled(thread);
274 scheduler_new_thread_entry(Thread* thread)
276 thread_resumes(thread);
278 SpinLocker locker(thread->time_lock);
279 thread->last_time = system_time();
283 /*! Switches the currently running thread.
286 \param fromThread The currently running thread.
287 \param toThread The thread to switch to. Must be different from
311 // been unscheduled earlier, but is back now. For a thread scheduled the
312 // first time the same is done in thread.cpp:common_thread_entry().
336 TRACE("reschedule(): cpu %ld, current thread = %ld\n", thisCPU,
355 TRACE("enqueueing thread %ld into run queue priority ="
360 TRACE("putting thread %ld back in run queue priority ="
373 TRACE("not enqueueing thread %ld into run queue next_state = %ld\n",
380 // select thread with the biggest priority and enqueue back the old thread
420 TRACE("reschedule(): cpu %ld, next thread = %ld\n", thisCPU,
457 Note: expects thread spinlock to be held
466 Thread* thread = thread_get_current_thread();
467 if (thread != NULL && nextState != B_THREAD_READY)
468 panic("scheduler_reschedule_no_op() called in non-ready thread");
477 scheduler_on_thread_create(Thread* thread, bool idleThread)
479 thread->scheduler_data = new(std::nothrow) ThreadData(thread);
480 if (thread->scheduler_data == NULL)
487 scheduler_on_thread_init(Thread* thread)
489 ASSERT(thread->scheduler_data != NULL);
491 if (thread_is_idle_thread(thread)) {
495 thread->previous_cpu = &gCPU[cpuID];
496 thread->pinned_to_cpu = 1;
498 thread->scheduler_data->Init(CoreEntry::GetCore(cpuID));
500 thread->scheduler_data->Init();
505 scheduler_on_thread_destroy(Thread* thread)
507 delete thread->scheduler_data;
512 thread. Interrupts must be disabled and will be disabled when returning.
579 // don't wait until the thread quantum ends
731 "<thread>\n"
732 "Analyzes scheduler tracing information for a given thread.\n"
733 " <thread> - ID of the thread.\n", 0);
796 // get the thread
797 Thread* thread;
799 thread = thread_get_current_thread();
800 thread->AcquireReference();
802 thread = Thread::Get(id);
803 if (thread == NULL)
806 BReference<Thread> threadReference(thread, true);
812 ThreadData* threadData = thread->scheduler_data;