Lines Matching refs:thread

108 #include <kern/thread.h>
277 thread_t thread;
291 /* FIXME: On x86, the thread save state flavor can diverge from the
294 * certain routines may observe the thread as being in an inconsistent
299 queue_iterate(&task->threads, thread, thread_t, task_threads) {
300 thread_mtx_lock(thread);
301 machine_thread_switch_addrmode(thread);
302 thread_mtx_unlock(thread);
1165 * (kern/thread.c) about problems with terminating the "current task."
1209 thread_t thread, self;
1253 * Make sure the current thread does not get aborted out of
1261 * each thread independently in thread_terminate_internal -
1278 * Terminate each thread in the task.
1280 queue_iterate(&task->threads, thread, thread_t, task_threads) {
1281 thread_terminate_internal(thread);
1323 * If the current thread is a member of the task
1325 * the task will not be dropped until the thread
1391 * Shut the current task down (except for the current thread) in
1400 thread_t thread, self;
1413 * Task or current thread is already being terminated.
1430 * would do this on a thread by thread basis anyway, but this
1438 queue_iterate(&task->threads, thread, thread_t, task_threads) {
1439 if (thread != self)
1440 thread_terminate_internal(thread);
1455 * current thread go in the (practically empty) task context.
1466 * When the last other thread is reaped, we'll be
1480 * associated with the current thread before
1519 register thread_t thread;
1529 queue_iterate(&task->threads, thread, thread_t, task_threads) {
1530 thread_mtx_lock(thread);
1531 thread_hold(thread);
1532 thread_mtx_unlock(thread);
1603 register thread_t thread, self;
1612 * stop. Do not wait for the current thread if it is within
1615 queue_iterate(&task->threads, thread, thread_t, task_threads) {
1616 if (thread != self)
1617 thread_wait(thread, until_not_runnable);
1632 register thread_t thread;
1640 queue_iterate(&task->threads, thread, thread_t, task_threads) {
1641 thread_mtx_lock(thread);
1642 thread_release(thread);
1643 thread_mtx_unlock(thread);
1684 thread_t thread;
1731 for (thread = (thread_t)queue_first(&task->threads); i < actual;
1732 ++i, thread = (thread_t)queue_next(&thread->task_threads)) {
1733 thread_reference_internal(thread);
1734 thread_list[j++] = thread;
1737 assert(queue_end(&task->threads, (queue_entry_t)thread));
1742 /* can unlock task now that we've got the thread refs */
2642 register thread_t thread;
2656 queue_iterate(&task->threads, thread, thread_t, task_threads) {
2659 if (thread->options & TH_OPT_IDLE_THREAD)
2662 thread_read_times(thread, &user_time, &system_time);
2675 register thread_t thread;
2689 queue_iterate(&task->threads, thread, thread_t, task_threads) {
2693 if (thread->options & TH_OPT_IDLE_THREAD)
2697 thread_lock(thread);
2699 tval = timer_grab(&thread->user_timer);
2703 tval = timer_grab(&thread->system_timer);
2704 if (thread->precise_user_kernel_time) {
2713 thread_unlock(thread);
2808 /* count all other task/thread shared alloc/free against the kernel */
2953 register thread_t thread;
2973 queue_iterate(&task->threads, thread, thread_t, task_threads) {
2974 events_info->csw += thread->c_switch;
2975 events_info->syscalls_mach += thread->syscalls_mach;
2976 events_info->syscalls_unix += thread->syscalls_unix;
3172 thread_t thread;
3192 queue_iterate(&task->threads, thread, thread_t, task_threads) {
3196 if (thread->options & TH_OPT_IDLE_THREAD)
3200 thread_lock(thread);
3202 info->task_timer_wakeups_bin_1 += thread->thread_timer_wakeups_bin_1;
3203 info->task_timer_wakeups_bin_2 += thread->thread_timer_wakeups_bin_2;
3205 tval = timer_grab(&thread->user_timer);
3208 tval = timer_grab(&thread->system_timer);
3209 if (thread->precise_user_kernel_time) {
3217 ginfo->task_gpu_utilisation += ml_gpu_stat(thread);
3219 thread_unlock(thread);
3235 thread_t thread;
3240 queue_iterate(&task->threads, thread, thread_t, task_threads) {
3243 thread_lock(thread);
3244 gpu_time += ml_gpu_stat(thread);
3245 thread_unlock(thread);
3273 thread_t thread;
3285 queue_iterate(&task->threads, thread, thread_t, task_threads) {
3287 thread_lock(thread);
3288 if (thread->precise_user_kernel_time)
3289 thread->vtimer_user_save = timer_grab(&thread->user_timer);
3291 thread->vtimer_user_save = timer_grab(&thread->system_timer);
3292 thread_unlock(thread);
3298 queue_iterate(&task->threads, thread, thread_t, task_threads) {
3300 thread_lock(thread);
3301 thread->vtimer_prof_save = timer_grab(&thread->user_timer);
3302 thread->vtimer_prof_save += timer_grab(&thread->system_timer);
3303 thread_unlock(thread);
3309 queue_iterate(&task->threads, thread, thread_t, task_threads) {
3311 thread_lock(thread);
3312 thread->vtimer_rlim_save = timer_grab(&thread->user_timer);
3313 thread->vtimer_rlim_save += timer_grab(&thread->system_timer);
3314 thread_unlock(thread);
3344 thread_t thread = current_thread();
3358 if (thread->precise_user_kernel_time) {
3359 tdelt = (uint32_t)timer_delta(&thread->user_timer,
3360 &thread->vtimer_user_save);
3362 tdelt = (uint32_t)timer_delta(&thread->system_timer,
3363 &thread->vtimer_user_save);
3369 tsum = timer_grab(&thread->user_timer);
3370 tsum += timer_grab(&thread->system_timer);
3371 tdelt = (uint32_t)(tsum - thread->vtimer_prof_save);
3375 thread->vtimer_prof_save = tsum;
3379 tsum = timer_grab(&thread->user_timer);
3380 tsum += timer_grab(&thread->system_timer);
3381 tdelt = (uint32_t)(tsum - thread->vtimer_rlim_save);
3382 thread->vtimer_rlim_save = tsum;
3501 * Install default (machine-dependent) initial thread state
3502 * on the task. Subsequent thread creation will have this initial
3503 * state set on the thread by machine_thread_inherit_taskwide().
3533 * Examine the default (machine-dependent) initial thread state
3827 * And it returns a thread handle without reference as the caller
3833 thread_t thread= THREAD_NULL;
3835 queue_iterate(&task->threads, thread, thread_t, task_threads) {
3836 if (thread->thread_id == tid)
3837 return(thread);