* @brief This function will remove a thread from system ready queue. * * @param thread is the thread to be removed. * * @note Please do not invoke this function in user application. */
| 540 | * @note Please do not invoke this function in user application. |
| 541 | */ |
| 542 | void rt_sched_remove_thread(struct rt_thread *thread) |
| 543 | { |
| 544 | rt_base_t level; |
| 545 | |
| 546 | RT_ASSERT(thread != RT_NULL); |
| 547 | |
| 548 | /* disable interrupt */ |
| 549 | level = rt_hw_interrupt_disable(); |
| 550 | |
| 551 | LOG_D("remove thread[%.*s], the priority: %d", |
| 552 | RT_NAME_MAX, thread->parent.name, |
| 553 | RT_SCHED_PRIV(rt_current_thread).current_priority); |
| 554 | |
| 555 | /* remove thread from ready list */ |
| 556 | rt_list_remove(&RT_THREAD_LIST_NODE(thread)); |
| 557 | if (rt_list_isempty(&(rt_thread_priority_table[RT_SCHED_PRIV(thread).current_priority]))) |
| 558 | { |
| 559 | #if RT_THREAD_PRIORITY_MAX > 32 |
| 560 | rt_thread_ready_table[RT_SCHED_PRIV(thread).number] &= ~RT_SCHED_PRIV(thread).high_mask; |
| 561 | if (rt_thread_ready_table[RT_SCHED_PRIV(thread).number] == 0) |
| 562 | { |
| 563 | rt_thread_ready_priority_group &= ~RT_SCHED_PRIV(thread).number_mask; |
| 564 | } |
| 565 | #else |
| 566 | rt_thread_ready_priority_group &= ~RT_SCHED_PRIV(thread).number_mask; |
| 567 | #endif /* RT_THREAD_PRIORITY_MAX > 32 */ |
| 568 | } |
| 569 | |
| 570 | /* enable interrupt */ |
| 571 | rt_hw_interrupt_enable(level); |
| 572 | } |
| 573 | |
| 574 | #ifdef RT_DEBUGING_CRITICAL |
| 575 |
no test coverage detected