Lines Matching refs:current_thread
315 thread_t *current_thread = get_current_thread(); in thread_create_etc() local
318 t->tls[i] = current_thread->tls[i]; in thread_create_etc()
397 static mp_cpu_mask_t thread_get_mp_reschedule_target(thread_t *current_thread, thread_t *t) in thread_get_mp_reschedule_target() argument
403 if (t->pinned_cpu != -1 && current_thread->pinned_cpu == t->pinned_cpu) in thread_get_mp_reschedule_target()
420 … __func__, cpu, target_cpu, cpu_priority[target_cpu], t->priority, current_thread->priority); in thread_get_mp_reschedule_target()
427 __func__, cpu, target_cpu, cpu_priority[target_cpu], t->priority, current_thread->priority); in thread_get_mp_reschedule_target()
443 static void thread_mp_reschedule(thread_t *current_thread, thread_t *t) in thread_mp_reschedule() argument
445 mp_reschedule(thread_get_mp_reschedule_target(current_thread, t), 0); in thread_mp_reschedule()
647 thread_t *current_thread = get_current_thread(); in thread_exit() local
649 DEBUG_ASSERT(current_thread->magic == THREAD_MAGIC); in thread_exit()
650 DEBUG_ASSERT(!thread_is_idle(current_thread)); in thread_exit()
651 DEBUG_ASSERT(current_thread->state == THREAD_RUNNING); in thread_exit()
653 thread_check_cookie(current_thread); in thread_exit()
660 current_thread->state = THREAD_DEATH; in thread_exit()
661 current_thread->retcode = retcode; in thread_exit()
664 if (current_thread->flags & THREAD_FLAG_DETACHED) { in thread_exit()
666 list_delete(¤t_thread->thread_list_node); in thread_exit()
669 list_add_tail(&dead_threads, ¤t_thread->thread_list_node); in thread_exit()
673 wait_queue_wake_all(¤t_thread->retcode_wait_queue, false, 0); in thread_exit()
692 thread_t *current_thread = get_current_thread(); in thread_exit_from_panic() local
694 DEBUG_ASSERT(current_thread->flags & THREAD_FLAG_EXIT_ON_PANIC); in thread_exit_from_panic()
700 current_thread->flags &= ~THREAD_FLAG_EXIT_ON_PANIC; in thread_exit_from_panic()
702 DEBUG_ASSERT(current_thread->state == THREAD_RUNNING || in thread_exit_from_panic()
703 current_thread->state == THREAD_READY); in thread_exit_from_panic()
707 current_thread->cookie = thread_get_expected_cookie(current_thread); in thread_exit_from_panic()
721 if (current_thread->state == THREAD_READY) { in thread_exit_from_panic()
723 delete_from_run_queue(current_thread); in thread_exit_from_panic()
725 current_thread->state = THREAD_RUNNING; in thread_exit_from_panic()
812 static void thread_pinned_cond_mp_reschedule(thread_t* current_thread, in thread_pinned_cond_mp_reschedule() argument
824 thread_mp_reschedule(current_thread, thread); in thread_pinned_cond_mp_reschedule()
829 static void thread_cond_mp_reschedule(thread_t *current_thread, const char *caller) in thread_cond_mp_reschedule() argument
857 current_thread->priority, current_thread->name); in thread_cond_mp_reschedule()
879 thread_t *current_thread = get_current_thread(); in thread_resched() local
884 DEBUG_ASSERT(current_thread->state != THREAD_RUNNING); in thread_resched()
894 thread_check_cookie(current_thread); in thread_resched()
903 thread_pinned_cond_mp_reschedule(newthread, current_thread, cpu); in thread_resched()
909 oldthread = current_thread; in thread_resched()
1029 thread_t *current_thread = get_current_thread(); in thread_yield() local
1031 DEBUG_ASSERT(current_thread->magic == THREAD_MAGIC); in thread_yield()
1032 DEBUG_ASSERT(current_thread->state == THREAD_RUNNING); in thread_yield()
1039 current_thread->state = THREAD_READY; in thread_yield()
1040 current_thread->remaining_quantum = 0; in thread_yield()
1041 if (likely(!thread_is_idle(current_thread))) { /* idle thread doesn't go in the run queue */ in thread_yield()
1042 insert_in_run_queue_tail(current_thread); in thread_yield()
1066 thread_t *current_thread = get_current_thread(); in thread_preempt_inner() local
1068 DEBUG_ASSERT(current_thread->magic == THREAD_MAGIC); in thread_preempt_inner()
1069 DEBUG_ASSERT(current_thread->state == THREAD_RUNNING); in thread_preempt_inner()
1072 if (!thread_is_idle(current_thread)) in thread_preempt_inner()
1076 KEVLOG_THREAD_PREEMPT(current_thread); in thread_preempt_inner()
1086 current_thread->state = THREAD_READY; in thread_preempt_inner()
1087 if (likely(!thread_is_idle(current_thread))) { /* idle thread doesn't go in the run queue */ in thread_preempt_inner()
1088 if (current_thread->remaining_quantum > 0) in thread_preempt_inner()
1089 insert_in_run_queue_head(current_thread); in thread_preempt_inner()
1091 …insert_in_run_queue_tail(current_thread); /* if we're out of quantum, go to the tail of the queue … in thread_preempt_inner()
1129 __UNUSED thread_t *current_thread = get_current_thread(); in thread_block() local
1131 DEBUG_ASSERT(current_thread->magic == THREAD_MAGIC); in thread_block()
1132 DEBUG_ASSERT(current_thread->state == THREAD_BLOCKED); in thread_block()
1134 DEBUG_ASSERT(!thread_is_idle(current_thread)); in thread_block()
1159 thread_t *current_thread = get_current_thread(); in thread_timer_callback() local
1161 if (thread_is_idle(current_thread)) in thread_timer_callback()
1165 thread_cond_mp_reschedule(current_thread, __func__); in thread_timer_callback()
1168 if (thread_is_real_time_or_idle(current_thread)) in thread_timer_callback()
1171 current_thread->remaining_quantum--; in thread_timer_callback()
1172 if (current_thread->remaining_quantum <= 0) { in thread_timer_callback()
1222 thread_t *current_thread = get_current_thread(); in thread_sleep_ns() local
1224 DEBUG_ASSERT(current_thread->magic == THREAD_MAGIC); in thread_sleep_ns()
1225 DEBUG_ASSERT(current_thread->state == THREAD_RUNNING); in thread_sleep_ns()
1226 DEBUG_ASSERT(!thread_is_idle(current_thread)); in thread_sleep_ns()
1232 (void *)current_thread); in thread_sleep_ns()
1233 current_thread->state = THREAD_SLEEPING; in thread_sleep_ns()
1333 thread_t *current_thread = get_current_thread(); in thread_set_name() local
1334 strlcpy(current_thread->name, name, sizeof(current_thread->name)); in thread_set_name()
1345 thread_t *current_thread = get_current_thread(); in thread_set_priority() local
1353 current_thread->priority = priority; in thread_set_priority()
1355 current_thread->state = THREAD_READY; in thread_set_priority()
1356 insert_in_run_queue_head(current_thread); in thread_set_priority()
1403 thread_t *current_thread = get_current_thread(); in thread_set_pinned_cpu() local
1404 DEBUG_ASSERT(t != current_thread); in thread_set_pinned_cpu()
1413 if (current_thread->priority < t->priority) { in thread_set_pinned_cpu()
1423 && thread_is_realtime(current_thread)) { in thread_set_pinned_cpu()
1443 thread_mp_reschedule(current_thread, t); in thread_set_pinned_cpu()
1451 thread_t *current_thread = get_current_thread(); in thread_set_pinned_cpu() local
1466 if (t == current_thread) { in thread_set_pinned_cpu()
1772 thread_t *current_thread = get_current_thread(); in wait_queue_block() local
1775 DEBUG_ASSERT(current_thread->state == THREAD_RUNNING); in wait_queue_block()
1782 list_add_tail(&wait->list, ¤t_thread->queue_node); in wait_queue_block()
1784 current_thread->state = THREAD_BLOCKED; in wait_queue_block()
1785 current_thread->blocking_wait_queue = wait; in wait_queue_block()
1786 current_thread->wait_queue_block_ret = NO_ERROR; in wait_queue_block()
1793 (void *)current_thread); in wait_queue_block()
1811 return current_thread->wait_queue_block_ret; in wait_queue_block()
1833 thread_t *current_thread = get_current_thread(); in wait_queue_wake_one() local
1854 current_thread->state = THREAD_READY; in wait_queue_wake_one()
1855 insert_in_run_queue_head(current_thread); in wait_queue_wake_one()
1858 thread_mp_reschedule(current_thread, t); in wait_queue_wake_one()
1890 thread_t *current_thread = get_current_thread(); in wait_queue_wake_all() local
1901 current_thread->state = THREAD_READY; in wait_queue_wake_all()
1902 insert_in_run_queue_head(current_thread); in wait_queue_wake_all()
1916 mp_reschedule_target |= thread_get_mp_reschedule_target(current_thread, t); in wait_queue_wake_all()
1925 DEBUG_ASSERT(current_thread->state == THREAD_READY); in wait_queue_wake_all()
1932 DEBUG_ASSERT(current_thread->state != THREAD_READY); in wait_queue_wake_all()
1939 DEBUG_ASSERT(current_thread->state != THREAD_READY); in wait_queue_wake_all()