static void _tc_cleanup() { /* 调度器上锁,上锁后,将不再切换到其他线程,仅响应中断 */ rt_enter_critical(); /* 删除线程 */ if (tid1 != RT_NULL && tid1->stat != RT_THREAD_CLOSE) rt_thread_delete(tid1); if (tid2 != RT_NULL && tid2->stat != RT_THREAD_CLOSE) rt_thread_delete(tid2); /* 执行内存池脱离 */ rt_mp_detach(&mp); /* 调度器解锁 */ rt_exit_critical(); /* 设置TestCase状态 */ tc_done(TC_STAT_PASSED); }
void rt_prio_queue_detach(struct rt_prio_queue *que) { /* wake up all suspended pop threads, push thread is suspended on mempool. */ while (!rt_list_isempty(&(que->suspended_pop_list))) { rt_thread_t thread; /* disable interrupt */ rt_ubase_t temp = rt_hw_interrupt_disable(); /* get next suspend thread */ thread = rt_list_entry(que->suspended_pop_list.next, struct rt_thread, tlist); /* set error code to RT_ERROR */ thread->error = -RT_ERROR; rt_thread_resume(thread); /* enable interrupt */ rt_hw_interrupt_enable(temp); } rt_mp_detach(&que->pool); }