/* This function will let current thread yield processor, and scheduler will choose a highest thread to run. After yield processor, the current thread is still in READY state. */
rt_err_t rt_thread_yield(void)
/* This function will let current thread yield processor, and scheduler will choose a highest thread to run. After yield processor, the current thread is still in READY state. */
rt_err_t rt_thread_yield(void)
{
    register rt_base_t level;
    struct rt_thread *thread;
    level = rt_hw_interrupt_disable();
    thread = rt_current_thread;
    if (thread->stat == RT_THREAD_READY &&
        thread->tlist.next != thread->tlist.prev)
    {
        rt_list_remove(&(thread->tlist));
        rt_list_insert_before(&(rt_thread_priority_table[thread->current_priority]),
                              &(thread->tlist));
        rt_hw_interrupt_enable(level);
        rt_schedule();
        return RT_EOK;
    }
    rt_hw_interrupt_enable(level);
    return RT_EOK;
}