MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_sched_remove_thread

Function rt_sched_remove_thread

src/scheduler_up.c:542–572  ·  view source on GitHub ↗

* @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. */

Source from the content-addressed store, hash-verified

540 * @note Please do not invoke this function in user application.
541 */
542void 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

Callers 5

rt_scheduleFunction · 0.70
rt_thread_closeFunction · 0.70

Calls 4

rt_list_removeFunction · 0.85
rt_list_isemptyFunction · 0.85
rt_hw_interrupt_disableFunction · 0.50
rt_hw_interrupt_enableFunction · 0.50

Tested by

no test coverage detected