Lines Matching refs:thread

35 #include <kern/thread.h>
58 #pragma mark **** thread binding ****
62 * This method will bind a given thread to the requested CPU starting at the
63 * next time quantum. If the thread is the current thread, this method will
65 * current thread, you will be on the requested CPU when this method returns.
68 chudxnu_bind_thread(thread_t thread, int cpu, __unused int options)
76 if(thread != current_thread())
91 * If we're trying to bind the current thread, and
93 * context, block the current thread to force a
96 if(thread == current_thread() &&
106 chudxnu_unbind_thread(thread_t thread, __unused int options)
108 if(thread == current_thread())
114 chudxnu_thread_get_idle(thread_t thread) {
117 * a given thread.
120 * suspended thread to avoid a race.
122 return ((thread->state & TH_IDLE) == TH_IDLE);
126 chudxnu_thread_get_scheduler_state(thread_t thread) {
129 * a given thread.
132 * locked thread, to avoid a race.
136 int schedulerState = (volatile int)(thread->state);
137 processor_t lastProcessor = (volatile processor_t)(thread->last_processor);
139 if ((PROCESSOR_NULL != lastProcessor) && (thread == lastProcessor->active_thread)) {
171 #pragma mark **** task and thread info ****
251 thread_t thread, *thread_list = (thread_t *)addr;
253 for (i = 0, thread = (thread_t)queue_first(&threads);
254 !queue_end(&threads, (queue_entry_t)thread);
255 thread = (thread_t)queue_next(&thread->threads)) {
256 thread_reference_internal(thread);
257 thread_list[actual++] = thread;
331 thread_t thread;
378 for (thread = (thread_t)queue_first(&task->threads); i < actual;
379 ++i, thread = (thread_t)queue_next(&thread->task_threads)) {
380 thread_reference_internal(thread);
381 thread_list[j++] = thread;
384 assert(queue_end(&task->threads, (queue_entry_t)thread));
389 /* can unlock task now that we've got the thread refs */
509 chudxnu_task_for_thread(thread_t thread)
511 return get_threadtask(thread);
516 thread_t thread,
521 return thread_info(thread, flavor, thread_info_out, thread_info_count);
525 /* thread marking stuff */
528 chudxnu_thread_get_marked(thread_t thread)
530 if(thread)
531 return ((thread->t_chud & T_CHUD_MARKED) != 0);
536 chudxnu_thread_set_marked(thread_t thread, boolean_t new_value)
540 if(thread) {
543 old_val = OSBitOrAtomic(T_CHUD_MARKED, &(thread->t_chud));
546 old_val = OSBitAndAtomic(~T_CHUD_MARKED, &(thread->t_chud));
562 chudxnu_thread_ast(thread_t thread)
567 handler( thread );
569 thread->t_chud = 0;
574 /* Get and set bits on the thread and trigger an AST handler */
575 void chudxnu_set_thread_ast( thread_t thread );
577 chudxnu_set_thread_ast( thread_t thread )
579 /* FIXME: only call this on current thread from an interrupt handler for now... */
580 if( thread != current_thread() )
583 act_set_kperf(thread);
586 /* get and set the thread bits */
587 extern uint32_t chudxnu_get_thread_bits( thread_t thread );
588 extern void chudxnu_set_thread_bits( thread_t thread, uint32_t bits );
591 chudxnu_get_thread_bits( thread_t thread )
593 return thread->t_chud;
597 chudxnu_set_thread_bits( thread_t thread, uint32_t bits )
599 thread->t_chud = bits;
602 /* get and set thread dirty bits. so CHUD can track whether the thread
604 * thread lock
607 chudxnu_thread_get_dirty(thread_t thread)
609 if( thread->c_switch != thread->chud_c_switch )
616 chudxnu_thread_set_dirty(thread_t thread, boolean_t makedirty)
619 thread->chud_c_switch = thread->c_switch - 1;
621 thread->chud_c_switch = thread->c_switch;