lk/kernel/thread.c
thread_resume:
/** * @brief Make a suspended thread executable. * * This function is typically called to start a thread which has just been * created with thread_create() * * @param t Thread to resume * * @return NO_ERROR on success, ERR_NOT_SUSPENDED if thread was not suspended. */ status_t thread_resume(thread_t *t) { DEBUG_ASSERT(t->magic == THREAD_MAGIC); DEBUG_ASSERT(t->state != THREAD_DEATH);
bool resched = false; bool ints_disabled = arch_ints_disabled(); THREAD_LOCK(state); if (t->state == THREAD_SUSPENDED) { t->state = THREAD_READY; insert_in_run_queue_head(t); if (!ints_disabled) /* HACK, don't resced into bootstrap thread before idle thread is set up */ resched = true; }
mp_reschedule(MP_CPU_ALL_BUT_LOCAL, 0);
THREAD_UNLOCK(state);
if (resched) thread_yield();
return NO_ERROR; }